本文整理汇总了Java中org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode类的典型用法代码示例。如果您正苦于以下问题:Java QuotedFieldQueryNode类的具体用法?Java QuotedFieldQueryNode怎么用?Java QuotedFieldQueryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuotedFieldQueryNode类属于org.apache.lucene.queryparser.flexible.core.nodes包,在下文中一共展示了QuotedFieldQueryNode类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessNode
import org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode; //导入依赖的package包/类
@Override
protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
// the old Lucene Parser ignores FuzzyQueryNode that are also PrefixWildcardQueryNode or WildcardQueryNode
// we do the same here, also ignore empty terms
if (node instanceof FieldQueryNode || node instanceof FuzzyQueryNode) {
FieldQueryNode fqn = (FieldQueryNode) node;
CharSequence text = fqn.getText();
// do not process wildcards for TermRangeQueryNode children and
// QuotedFieldQueryNode to reproduce the old parser behavior
if (fqn.getParent() instanceof TermRangeQueryNode
|| fqn instanceof QuotedFieldQueryNode
|| text.length() <= 0){
// Ignore empty terms
return node;
}
// Code below simulates the old lucene parser behavior for wildcards
if (isPrefixWildcard(text)) {
PrefixWildcardQueryNode prefixWildcardQN = new PrefixWildcardQueryNode(fqn);
return prefixWildcardQN;
} else if (isWildcard(text)){
WildcardQueryNode wildcardQN = new WildcardQueryNode(fqn);
return wildcardQN;
}
}
return node;
}