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

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


  public NodeWildcardQueryNodeBuilder() {
    // empty constructor
  }

  public NodeWildcardQuery build(final QueryNode queryNode) throws QueryNodeException {
    final WildcardQueryNode wildcardNode = (WildcardQueryNode) queryNode;

    final NodeWildcardQuery q = new NodeWildcardQuery(new Term(wildcardNode.getFieldAsString(),
                                                         wildcardNode.getTextAsString()));

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


    // empty constructor
  }

  @Override
  public WildcardQuery build(QueryNode queryNode) throws QueryNodeException {
    WildcardQueryNode wildcardNode = (WildcardQueryNode) queryNode;

    WildcardQuery q = new WildcardQuery(new Term(wildcardNode.getFieldAsString(),
                                                 wildcardNode.getTextAsString()));
   
    MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode.getTag(MultiTermRewriteMethodProcessor.TAG_ID);
    if (method != null) {
      q.setRewriteMethod(method);
    }
View Full Code Here

  @Override
  protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {

    if (node instanceof WildcardQueryNode) {
      WildcardQueryNode wildcardNode = (WildcardQueryNode) node;

      if (wildcardNode.getText().length() > 0) {
       
        // Validate if the wildcard was escaped
        if (UnescapedCharSequence.wasEscaped(wildcardNode.getText(), 0))
          return node;
       
        switch (wildcardNode.getText().charAt(0)) {   
          case '*':
          case '?':
            throw new QueryNodeException(new MessageImpl(
                QueryParserMessages.LEADING_WILDCARD_NOT_ALLOWED, node
                    .toQueryString(new EscapeQuerySyntaxImpl())));   
View Full Code Here

      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.WildcardQueryNode

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.