• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PrefixWildcardQueryNode类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode的典型用法代码示例。如果您正苦于以下问题:Java PrefixWildcardQueryNode类的具体用法?Java PrefixWildcardQueryNode怎么用?Java PrefixWildcardQueryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

PrefixWildcardQueryNode类属于org.apache.lucene.queryparser.flexible.standard.nodes包,在下文中一共展示了PrefixWildcardQueryNode类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: StandardQueryTreeBuilder

点赞 3

import org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode; //导入依赖的package包/类
public StandardQueryTreeBuilder() {
  setBuilder(GroupQueryNode.class, new GroupQueryNodeBuilder());
  setBuilder(FieldQueryNode.class, new FieldQueryNodeBuilder());
  setBuilder(BooleanQueryNode.class, new BooleanQueryNodeBuilder());
  setBuilder(FuzzyQueryNode.class, new FuzzyQueryNodeBuilder());
  setBuilder(NumericQueryNode.class, new DummyQueryNodeBuilder());
  setBuilder(NumericRangeQueryNode.class, new NumericRangeQueryNodeBuilder());
  setBuilder(BoostQueryNode.class, new BoostQueryNodeBuilder());
  setBuilder(ModifierQueryNode.class, new ModifierQueryNodeBuilder());
  setBuilder(WildcardQueryNode.class, new WildcardQueryNodeBuilder());
  setBuilder(TokenizedPhraseQueryNode.class, new PhraseQueryNodeBuilder());
  setBuilder(MatchNoDocsQueryNode.class, new MatchNoDocsQueryNodeBuilder());
  setBuilder(PrefixWildcardQueryNode.class,
      new PrefixWildcardQueryNodeBuilder());
  setBuilder(TermRangeQueryNode.class, new TermRangeQueryNodeBuilder());
  setBuilder(RegexpQueryNode.class, new RegexpQueryNodeBuilder());
  setBuilder(SlopQueryNode.class, new SlopQueryNodeBuilder());
  setBuilder(StandardBooleanQueryNode.class,
      new StandardBooleanQueryNodeBuilder());
  setBuilder(MultiPhraseQueryNode.class, new MultiPhraseQueryNodeBuilder());
  setBuilder(MatchAllDocsQueryNode.class, new MatchAllDocsQueryNodeBuilder());
  
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:24,
代码来源:StandardQueryTreeBuilder.java

示例2: postProcessNode

点赞 2

import org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode; //导入依赖的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;

}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:35,
代码来源:WildcardQueryNodeProcessor.java

示例3: build

点赞 2

import org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode; //导入依赖的package包/类
@Override
public PrefixQuery build(QueryNode queryNode) throws QueryNodeException {    

  PrefixWildcardQueryNode wildcardNode = (PrefixWildcardQueryNode) queryNode;

  String text = wildcardNode.getText().subSequence(0, wildcardNode.getText().length() - 1).toString();
  PrefixQuery q = new PrefixQuery(new Term(wildcardNode.getFieldAsString(), text));
  
  MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode.getTag(MultiTermRewriteMethodProcessor.TAG_ID);
  if (method != null) {
    q.setRewriteMethod(method);
  }
  
  return q;
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:16,
代码来源:PrefixWildcardQueryNodeBuilder.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)