Search in sources :

Example 26 with Index

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));
}
Also used : Chain(com.yahoo.component.chain.Chain) Execution(com.yahoo.search.searchchain.Execution) IndexFacts(com.yahoo.prelude.IndexFacts) Index(com.yahoo.prelude.Index) Before(org.junit.Before)

Example 27 with Index

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;
}
Also used : IndexFacts(com.yahoo.prelude.IndexFacts) Index(com.yahoo.prelude.Index)

Example 28 with Index

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;
}
Also used : IndexFacts(com.yahoo.prelude.IndexFacts) Index(com.yahoo.prelude.Index)

Example 29 with Index

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;
}
Also used : IndexFacts(com.yahoo.prelude.IndexFacts) Index(com.yahoo.prelude.Index)

Example 30 with Index

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());
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) IndexFacts(com.yahoo.prelude.IndexFacts) Index(com.yahoo.prelude.Index) Token(com.yahoo.prelude.query.parser.Token) Tokenizer(com.yahoo.prelude.query.parser.Tokenizer) Test(org.junit.Test)

Aggregations

Index (com.yahoo.prelude.Index)36 IndexFacts (com.yahoo.prelude.IndexFacts)23 Test (org.junit.Test)13 SimpleLinguistics (com.yahoo.language.simple.SimpleLinguistics)7 Query (com.yahoo.search.Query)6 SearchDefinition (com.yahoo.prelude.SearchDefinition)5 Token (com.yahoo.prelude.query.parser.Token)5 Tokenizer (com.yahoo.prelude.query.parser.Tokenizer)5 Execution (com.yahoo.search.searchchain.Execution)4 JSONString (com.yahoo.prelude.hitfield.JSONString)2 XMLString (com.yahoo.prelude.hitfield.XMLString)2 CompositeItem (com.yahoo.prelude.query.CompositeItem)2 Hit (com.yahoo.search.result.Hit)2 List (java.util.List)2 Before (org.junit.Before)2 Chain (com.yahoo.component.chain.Chain)1 Language (com.yahoo.language.Language)1 StemMode (com.yahoo.language.process.StemMode)1 IndexModel (com.yahoo.prelude.IndexModel)1 FastHit (com.yahoo.prelude.fastsearch.FastHit)1