本文整理匯總了Java中org.apache.solr.schema.PreAnalyzedField.createFieldType方法的典型用法代碼示例。如果您正苦於以下問題:Java PreAnalyzedField.createFieldType方法的具體用法?Java PreAnalyzedField.createFieldType怎麽用?Java PreAnalyzedField.createFieldType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.schema.PreAnalyzedField
的用法示例。
在下文中一共展示了PreAnalyzedField.createFieldType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}