本文整理汇总了Java中org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler.get方法的典型用法代码示例。如果您正苦于以下问题:Java QueryConfigHandler.get方法的具体用法?Java QueryConfigHandler.get怎么用?Java QueryConfigHandler.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler
的用法示例。
在下文中一共展示了QueryConfigHandler.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preProcessNode
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler; //导入方法依赖的package包/类
@Override
protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException {
if (node instanceof FieldableNode) {
FieldableNode fieldNode = (FieldableNode) node;
QueryConfigHandler queryConfig = getQueryConfigHandler();
if (queryConfig == null) {
throw new IllegalArgumentException(
"A config handler is expected by the processor UniqueFieldQueryNodeProcessor!");
}
if (!queryConfig.has(SpansQueryConfigHandler.UNIQUE_FIELD)) {
throw new IllegalArgumentException(
"UniqueFieldAttribute should be defined in the config handler!");
}
String uniqueField = queryConfig.get(SpansQueryConfigHandler.UNIQUE_FIELD);
fieldNode.setField(uniqueField);
}
return node;
}
示例2: preProcessNode
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler; //导入方法依赖的package包/类
@Override
protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException {
if (node instanceof FuzzyQueryNode) {
FuzzyQueryNode fuzzyNode = (FuzzyQueryNode) node;
QueryConfigHandler config = getQueryConfigHandler();
FuzzyConfig fuzzyConfig = null;
if (config != null && (fuzzyConfig = config.get(ConfigurationKeys.FUZZY_CONFIG)) != null) {
fuzzyNode.setPrefixLength(fuzzyConfig.getPrefixLength());
if (fuzzyNode.getSimilarity() < 0) {
fuzzyNode.setSimilarity(fuzzyConfig.getMinSimilarity());
}
} else if (fuzzyNode.getSimilarity() < 0) {
throw new IllegalArgumentException("No FUZZY_CONFIG set in the config");
}
}
return node;
}
示例3: process
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler; //导入方法依赖的package包/类
@Override
public QueryNode process(QueryNode queryTree) throws QueryNodeException {
QueryConfigHandler queryConfig = getQueryConfigHandler();
if (queryConfig != null) {
Integer defaultPhraseSlop = queryConfig.get(ConfigurationKeys.PHRASE_SLOP);
if (defaultPhraseSlop != null) {
this.defaultPhraseSlop = defaultPhraseSlop;
return super.process(queryTree);
}
}
return queryTree;
}