protected QueryNode preProcessNode(QueryNode node) throws QueryNodeException {
if (node instanceof FieldableNode) {
this.processChildren = false;
FieldableNode fieldNode = (FieldableNode) node;
if (fieldNode.getField() == null) {
if (!getQueryConfigHandler().hasAttribute(MultiFieldAttribute.class)) {
throw new IllegalArgumentException(
"MultiFieldAttribute should be set on the QueryConfigHandler");
}
CharSequence[] fields = ((MultiFieldAttribute) getQueryConfigHandler()
.getAttribute(MultiFieldAttribute.class)).getFields();
if (fields != null && fields.length > 0) {
fieldNode.setField(fields[0]);
if (fields.length == 1) {
return fieldNode;
} else {
LinkedList<QueryNode> children = new LinkedList<QueryNode>();
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) {
// should never happen