本文整理汇总了Java中org.apache.solr.schema.PreAnalyzedField类的典型用法代码示例。如果您正苦于以下问题:Java PreAnalyzedField类的具体用法?Java PreAnalyzedField怎么用?Java PreAnalyzedField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PreAnalyzedField类属于org.apache.solr.schema包,在下文中一共展示了PreAnalyzedField类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mutate
import org.apache.solr.schema.PreAnalyzedField; //导入依赖的package包/类
@Override
protected SolrInputField mutate(SolrInputField src) {
SchemaField sf = schema.getFieldOrNull(src.getName());
if (sf == null) { // remove this field
return null;
}
FieldType type = PreAnalyzedField.createFieldType(sf);
if (type == null) { // neither indexed nor stored - skip
return null;
}
SolrInputField res = new SolrInputField(src.getName());
res.setBoost(src.getBoost());
for (Object o : src) {
if (o == null) {
continue;
}
Field pre = (Field)parser.createField(sf, o, 1.0f);
if (pre != null) {
res.addValue(pre, 1.0f);
} else { // restore the original value
log.warn("Could not parse field {} - using original value as is: {}", src.getName(), o);
res.addValue(o, 1.0f);
}
}
return res;
}
示例2: handleIndexableField
import org.apache.solr.schema.PreAnalyzedField; //导入依赖的package包/类
private IndexableField handleIndexableField(SchemaField field, String source, String target, float boost) {
if (StringUtils.isEmpty(source) || StringUtils.isEmpty(target)) {
return null;
}
FieldType fieldType = PreAnalyzedField.createFieldType(field);
if (null == fieldType) {
return null;
}
Field indexableField = null;
if (field.stored()) {
indexableField = new Field(field.getName(), target, fieldType);
}
if (field.indexed()) {
TokenStream tokenStream = ((MultiLangAnalyzer) this.getAnalyzer()).createComponents(field.getName(),
new StringReader(source)).getTokenStream();
if (null != indexableField) {
indexableField.setTokenStream(tokenStream);
} else {
indexableField = new Field(field.getName(), tokenStream, fieldType);
}
}
if (null != indexableField) {
indexableField.setBoost(boost);
}
return indexableField;
}
示例3: inform
import org.apache.solr.schema.PreAnalyzedField; //导入依赖的package包/类
@Override
public void inform(SolrCore core) {
super.inform(core);
parser = new PreAnalyzedField();
Map<String,String> args = new HashMap<>();
if (parserImpl != null) {
args.put(PreAnalyzedField.PARSER_IMPL, parserImpl);
}
parser.init(core.getLatestSchema(), args);
}
示例4: inform
import org.apache.solr.schema.PreAnalyzedField; //导入依赖的package包/类
@Override
public void inform(SolrCore core) {
super.inform(core);
parser = new PreAnalyzedField();
Map<String,String> args = new HashMap<String,String>();
if (parserImpl != null) {
args.put(PreAnalyzedField.PARSER_IMPL, parserImpl);
}
parser.init(core.getLatestSchema(), args);
}
示例5: PreAnalyzedUpdateProcessor
import org.apache.solr.schema.PreAnalyzedField; //导入依赖的package包/类
public PreAnalyzedUpdateProcessor(FieldNameSelector sel, UpdateRequestProcessor next, IndexSchema schema, PreAnalyzedField parser) {
super(sel, next);
this.schema = schema;
this.parser = parser;
}