use of com.yahoo.prelude.query.SimpleIndexedItem in project vespa by vespa-engine.
the class QueryRewrite method rewriteSddocname.
private static Item rewriteSddocname(Item item) {
if (item instanceof CompositeItem) {
CompositeItem parent = (CompositeItem) item;
for (int i = 0, len = parent.getItemCount(); i < len; ++i) {
Item oldChild = parent.getItem(i);
Item newChild = rewriteSddocname(oldChild);
if (oldChild != newChild) {
parent.setItem(i, newChild);
}
}
} else if (item instanceof SimpleIndexedItem) {
SimpleIndexedItem oldItem = (SimpleIndexedItem) item;
if (Hit.SDDOCNAME_FIELD.equals(oldItem.getIndexName())) {
SubstringItem newItem = new SubstringItem(oldItem.getIndexedString());
newItem.setIndexName("[documentmetastore]");
return newItem;
}
}
return item;
}
use of com.yahoo.prelude.query.SimpleIndexedItem in project vespa by vespa-engine.
the class QueryRewrite method rewriteSddocname.
/**
* Replaces and {@link SimpleIndexedItem} searching in the {@link Hit#SDDOCNAME_FIELD} with an item
* appropriate for the search node.
*/
public static void rewriteSddocname(Query query) {
Item oldRoot = query.getModel().getQueryTree().getRoot();
Item newRoot = rewriteSddocname(oldRoot);
if (oldRoot != newRoot) {
query.getModel().getQueryTree().setRoot(newRoot);
}
}
Aggregations