use of org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode in project lucene-solr by apache.
the class StandardSyntaxParser method DisjQuery.
public final QueryNode DisjQuery(CharSequence field) throws ParseException {
QueryNode first, c;
Vector<QueryNode> clauses = null;
first = ConjQuery(field);
label_2: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case OR:
;
break;
default:
jj_la1[3] = jj_gen;
break label_2;
}
jj_consume_token(OR);
c = ConjQuery(field);
if (clauses == null) {
clauses = new Vector<QueryNode>();
clauses.addElement(first);
}
clauses.addElement(c);
}
if (clauses != null) {
{
if (true)
return new OrQueryNode(clauses);
}
} else {
{
if (true)
return first;
}
}
throw new Error("Missing return statement in function");
}
use of org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode in project lucene-solr by apache.
the class MultiFieldQueryNodeProcessor method preProcessNode.
@Override
protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException {
if (node instanceof FieldableNode) {
this.processChildren = false;
FieldableNode fieldNode = (FieldableNode) node;
if (fieldNode.getField() == null) {
CharSequence[] fields = getQueryConfigHandler().get(ConfigurationKeys.MULTI_FIELDS);
if (fields == null) {
throw new IllegalArgumentException("StandardQueryConfigHandler.ConfigurationKeys.MULTI_FIELDS should be set on the QueryConfigHandler");
}
if (fields != null && fields.length > 0) {
fieldNode.setField(fields[0]);
if (fields.length == 1) {
return fieldNode;
} else {
List<QueryNode> children = new ArrayList<>(fields.length);
children.add(fieldNode);
for (int i = 1; i < fields.length; i++) {
try {
fieldNode = (FieldableNode) fieldNode.cloneTree();
fieldNode.setField(fields[i]);
children.add(fieldNode);
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
return new GroupQueryNode(new OrQueryNode(children));
}
}
}
}
return node;
}
Aggregations