use of com.yahoo.search.config.IndexInfoConfig.Indexinfo in project vespa by vespa-engine.
the class YqlParserTestCase method testFieldAliases.
@Test
public void testFieldAliases() {
IndexInfoConfig modelConfig = new IndexInfoConfig(new IndexInfoConfig.Builder().indexinfo(new Indexinfo.Builder().name("music").command(new Command.Builder().indexname("title").command("index")).alias(new Alias.Builder().alias("song").indexname("title"))));
IndexModel model = new IndexModel(modelConfig, (QrSearchersConfig) null);
IndexFacts indexFacts = new IndexFacts(model);
ParserEnvironment parserEnvironment = new ParserEnvironment().setIndexFacts(indexFacts);
YqlParser configuredParser = new YqlParser(parserEnvironment);
QueryTree x = configuredParser.parse(new Parsable().setQuery("select * from sources * where title contains \"a\" and song contains \"b\";"));
List<IndexedItem> terms = QueryTree.getPositiveTerms(x);
assertEquals(2, terms.size());
for (IndexedItem term : terms) {
assertEquals("title", term.getIndexName());
}
}
Aggregations