use of com.yahoo.prelude.Index in project vespa by vespa-engine.
the class LowercasingTestCase method setUp.
@Before
public void setUp() throws Exception {
IndexFacts f = new IndexFacts();
Index bamse = new Index(BAMSE);
Index teddy = new Index(TEDDY);
Index defaultIndex = new Index("default");
bamse.setLowercase(true);
teddy.setLowercase(false);
defaultIndex.setLowercase(true);
f.addIndex("nalle", bamse);
f.addIndex("nalle", teddy);
f.addIndex("nalle", defaultIndex);
f.freeze();
settings = f;
execution = new Execution(new Chain<Searcher>(new VespaLowercasingSearcher(new LowercasingConfig(new LowercasingConfig.Builder()))), Execution.Context.createContextStub(settings));
}
use of com.yahoo.prelude.Index in project vespa by vespa-engine.
the class WandSearcherTestCase method buildIndexFacts.
private IndexFacts buildIndexFacts() {
IndexFacts retval = new IndexFacts();
retval.addIndex("test", new Index(VESPA_FIELD));
retval.freeze();
return retval;
}
use of com.yahoo.prelude.Index in project vespa by vespa-engine.
the class SortingDegraderTestCase method createIndexFacts.
private IndexFacts createIndexFacts() {
IndexFacts indexFacts = new IndexFacts();
Index fastSearchAttribute1 = new Index("a1");
fastSearchAttribute1.setFastSearch(true);
fastSearchAttribute1.setNumerical(true);
Index fastSearchAttribute2 = new Index("a2");
fastSearchAttribute2.setFastSearch(true);
fastSearchAttribute2.setNumerical(true);
Index nonFastSearchAttribute = new Index("nonFastSearchAttribute");
nonFastSearchAttribute.setNumerical(true);
Index stringAttribute = new Index("stringAttribute");
stringAttribute.setFastSearch(true);
indexFacts.addIndex("test", fastSearchAttribute1);
indexFacts.addIndex("test", fastSearchAttribute2);
indexFacts.addIndex("test", nonFastSearchAttribute);
indexFacts.addIndex("stringAttribute", stringAttribute);
return indexFacts;
}
use of com.yahoo.prelude.Index in project vespa by vespa-engine.
the class RangeQueryOptimizerTestCase method createIndexFacts.
private static IndexFacts createIndexFacts() {
IndexFacts indexFacts = new IndexFacts();
Index singleValue1 = new Index("s");
Index singleValue2 = new Index("t");
Index multiValue = new Index("m");
multiValue.setMultivalue(true);
indexFacts.addIndex("test", singleValue1);
indexFacts.addIndex("test", singleValue2);
indexFacts.addIndex("test", multiValue);
return indexFacts;
}
use of com.yahoo.prelude.Index in project vespa by vespa-engine.
the class TokenizerTestCase method testExactMatchTokenizationTerminatorTerminatesQuery.
@Test
public void testExactMatchTokenizationTerminatorTerminatesQuery() {
Index index1 = new Index("testexact1");
index1.setExact(true, null);
Index index2 = new Index("testexact2");
index2.setExact(true, "()/aa*::*&");
IndexFacts facts = new IndexFacts();
facts.addIndex("testsd", index1);
facts.addIndex("testsd", index2);
Tokenizer tokenizer = new Tokenizer(new SimpleLinguistics());
IndexFacts.Session session = facts.newSession(Collections.emptySet(), Collections.emptySet());
List<?> tokens = tokenizer.tokenize("normal a:b (normal testexact1:/,%#%&+-+ ) testexact2:ho_/&%&/()/aa*::*&", session);
assertEquals(new Token(WORD, "normal"), tokens.get(0));
assertEquals(new Token(SPACE, " "), tokens.get(1));
assertEquals(new Token(WORD, "a"), tokens.get(2));
assertEquals(new Token(COLON, ":"), tokens.get(3));
assertEquals(new Token(WORD, "b"), tokens.get(4));
assertEquals(new Token(SPACE, " "), tokens.get(5));
assertEquals(new Token(LBRACE, "("), tokens.get(6));
assertEquals(new Token(WORD, "normal"), tokens.get(7));
assertEquals(new Token(SPACE, " "), tokens.get(8));
assertEquals(new Token(WORD, "testexact1"), tokens.get(9));
assertEquals(new Token(COLON, ":"), tokens.get(10));
assertEquals(new Token(WORD, "/,%#%&+-+"), tokens.get(11));
assertEquals(new Token(SPACE, " "), tokens.get(12));
assertEquals(new Token(RBRACE, ")"), tokens.get(13));
assertEquals(new Token(SPACE, " "), tokens.get(14));
assertEquals(new Token(WORD, "testexact2"), tokens.get(15));
assertEquals(new Token(COLON, ":"), tokens.get(16));
assertEquals(new Token(WORD, "ho_/&%&/"), tokens.get(17));
assertTrue(((Token) tokens.get(17)).isSpecial());
}
Aggregations