本文整理匯總了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;
}