Search in sources :

Example 16 with Search

use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.

the class NGramTestCase method testInvalidNGramSetting1.

@Test
public void testInvalidNGramSetting1() throws IOException, ParseException {
    try {
        Search search = SearchBuilder.buildFromFile("src/test/examples/invalidngram1.sd");
        fail("Should cause an exception");
    } catch (IllegalArgumentException e) {
        assertEquals("gram-size can only be set when the matching mode is 'gram'", e.getMessage());
    }
}
Also used : Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 17 with Search

use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.

the class NGramTestCase method testInvalidNGramSetting2.

@Test
public void testInvalidNGramSetting2() throws IOException, ParseException {
    try {
        Search search = SearchBuilder.buildFromFile("src/test/examples/invalidngram2.sd");
        fail("Should cause an exception");
    } catch (IllegalArgumentException e) {
        assertEquals("gram-size can only be set when the matching mode is 'gram'", e.getMessage());
    }
}
Also used : Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 18 with Search

use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.

the class WeightedSetSummaryToTestCase method testRequireThatImplicitFieldsAreCreated.

@Test
public void testRequireThatImplicitFieldsAreCreated() throws IOException, ParseException {
    Search search = SearchBuilder.buildFromFile("src/test/examples/weightedset-summaryto.sd");
    assertNotNull(search);
}
Also used : Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 19 with Search

use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.

the class IndexingScriptRewriterTestCase method processField.

private static ScriptExpression processField(SDField unprocessedField) {
    SDDocumentType sdoc = new SDDocumentType("test");
    sdoc.addField(unprocessedField);
    Search search = new Search("test", null);
    search.addDocument(sdoc);
    Processing.process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true);
    return unprocessedField.getIndexingScript();
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles)

Example 20 with Search

use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.

the class PositionTestCase method requireThatExtraFieldCanBePositionAttribute.

@Test
public void requireThatExtraFieldCanBePositionAttribute() throws Exception {
    Search search = SearchBuilder.buildFromFile("src/test/examples/position_extra.sd");
    assertNull(search.getAttribute("pos_ext"));
    assertNull(search.getAttribute("pos_ext.x"));
    assertNull(search.getAttribute("pos_ext.y"));
    assertPositionAttribute(search, "pos_ext", Attribute.CollectionType.SINGLE);
    assertPositionSummary(search, "pos_ext", false);
}
Also used : Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Aggregations

Search (com.yahoo.searchdefinition.Search)62 Test (org.junit.Test)47 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)21 SDField (com.yahoo.searchdefinition.document.SDField)15 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)13 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)12 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)8 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)8 SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)6 File (java.io.File)5 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)4 RankProfile (com.yahoo.searchdefinition.RankProfile)3 Field (com.yahoo.document.Field)2 StructDataType (com.yahoo.document.StructDataType)2 WeightedSetDataType (com.yahoo.document.WeightedSetDataType)2 DocumentReference (com.yahoo.searchdefinition.DocumentReference)2 Index (com.yahoo.searchdefinition.Index)2 UnprocessingSearchBuilder (com.yahoo.searchdefinition.UnprocessingSearchBuilder)2 Attribute (com.yahoo.searchdefinition.document.Attribute)2 ImportedField (com.yahoo.searchdefinition.document.ImportedField)2