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

Examples of org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode


              } else {
                if (currentQuery != null) {
                  if (this.defaultOperator == Operator.OR) {
                    q.add(currentQuery);
                  } else {
                    q.add(new ModifierQueryNode(currentQuery, Modifier.MOD_REQ));
                  }
                }
                currentQuery = new FieldQueryNode(field, term, -1, -1);
              }
            }
            if (this.defaultOperator == Operator.OR) {
              q.add(currentQuery);
            } else {
              q.add(new ModifierQueryNode(currentQuery, Modifier.MOD_REQ));
            }
           
            if (q instanceof BooleanQueryNode) {
              q = new GroupQueryNode(q);
            }
View Full Code Here


  QueryNode q;
  ModifierQueryNode.Modifier mods;
    mods = Modifiers();
    q = Clause(field);
        if (mods != ModifierQueryNode.Modifier.MOD_NONE) {
          q = new ModifierQueryNode(q, mods);
        }
        {if (true) return q;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

  QueryNode q;
  ModifierQueryNode.Modifier mods;
    mods = Modifiers();
    q = Clause(field);
        if (mods != ModifierQueryNode.Modifier.MOD_NONE) {
          q = new ModifierQueryNode(q, mods);
        }
        {if (true) return q;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

  }

  private static BooleanClause.Occur getModifierValue(QueryNode node) {

    if (node instanceof ModifierQueryNode) {
      ModifierQueryNode mNode = ((ModifierQueryNode) node);
      switch (mNode.getModifier()) {

      case MOD_REQ:
        return BooleanClause.Occur.MUST;

      case MOD_NOT:
View Full Code Here

    // empty constructor
  }

  @Override
  public Query build(QueryNode queryNode) throws QueryNodeException {
    ModifierQueryNode modifierNode = (ModifierQueryNode) queryNode;

    return (Query) (modifierNode).getChild().getTag(
        QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);

  }
View Full Code Here

  }

  private static BooleanClause.Occur getModifierValue(QueryNode node) {

    if (node instanceof ModifierQueryNode) {
      ModifierQueryNode mNode = ((ModifierQueryNode) node);
      Modifier modifier = mNode.getModifier();

      if (Modifier.MOD_NONE.equals(modifier)) {
        return BooleanClause.Occur.SHOULD;

      } else if (Modifier.MOD_NOT.equals(modifier)) {
View Full Code Here

      if (parent instanceof OrQueryNode) {

        if (node instanceof ModifierQueryNode) {

          ModifierQueryNode modNode = (ModifierQueryNode) node;

          if (modNode.getModifier() == Modifier.MOD_REQ) {
            return modNode.getChild();
          }

        }

      } else {

        if (node instanceof ModifierQueryNode) {

          ModifierQueryNode modNode = (ModifierQueryNode) node;

          if (modNode.getModifier() == Modifier.MOD_NONE) {
            return new BooleanModifierNode(modNode.getChild(), Modifier.MOD_REQ);
          }

        } else {
          return new BooleanModifierNode(node, Modifier.MOD_REQ);
        }

      }

    } else {

      if (node.getParent() instanceof AndQueryNode) {

        if (node instanceof ModifierQueryNode) {

          ModifierQueryNode modNode = (ModifierQueryNode) node;

          if (modNode.getModifier() == Modifier.MOD_NONE) {
            return new BooleanModifierNode(modNode.getChild(), Modifier.MOD_REQ);
          }

        } else {
          return new BooleanModifierNode(node, Modifier.MOD_REQ);
        }
View Full Code Here

              } else {
                if (currentQuery != null) {
                  if (this.defaultOperator == Operator.OR) {
                    q.add(currentQuery);
                  } else {
                    q.add(new ModifierQueryNode(currentQuery, Modifier.MOD_REQ));
                  }
                }
                currentQuery = new FieldQueryNode(field, term, -1, -1);
              }
            }
            if (this.defaultOperator == Operator.OR) {
              q.add(currentQuery);
            } else {
              q.add(new ModifierQueryNode(currentQuery, Modifier.MOD_REQ));
            }
           
            if (q instanceof BooleanQueryNode) {
              q = new GroupQueryNode(q);
            }
View Full Code Here

      if (children != null && children.size() == 1) {
        QueryNode child = children.get(0);

        if (child instanceof ModifierQueryNode) {
          ModifierQueryNode modNode = (ModifierQueryNode) child;

          if (modNode instanceof BooleanModifierNode
              || modNode.getModifier() == Modifier.MOD_NONE) {

            return child;

          }
View Full Code Here

    // check if modifier is not already defined and is default
    if (!(node instanceof ModifierQueryNode)) {
      return new BooleanModifierNode(node, mod);
     
    } else {
      ModifierQueryNode modNode = (ModifierQueryNode) node;
     
      if (modNode.getModifier() == Modifier.MOD_NONE) {
        return new ModifierQueryNode(modNode.getChild(), mod);
      }
     
    }
   
    return node;
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode

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.