Package org.apache.lucene.queryparser.flexible.standard.nodes

Examples of org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode


  public NodePrefixWildcardQueryNodeBuilder() {
    // empty constructor
  }

  public NodePrefixQuery build(final QueryNode queryNode) throws QueryNodeException {
    final PrefixWildcardQueryNode wildcardNode = (PrefixWildcardQueryNode) queryNode;

    final String text = wildcardNode.getText().subSequence(0, wildcardNode.getText().length() - 1).toString();
    final NodePrefixQuery q = new NodePrefixQuery(new Term(wildcardNode.getFieldAsString(), text));

    final MultiNodeTermQuery.RewriteMethod method = (MultiNodeTermQuery.RewriteMethod)queryNode.getTag(MultiNodeTermRewriteMethodProcessor.TAG_ID);
    if (method != null) {
      q.setRewriteMethod(method);
    }
View Full Code Here


  }

  @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);
    }
View Full Code Here

      }
     
      // 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;
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryparser.flexible.standard.nodes.PrefixWildcardQueryNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.