use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class ImplicitSearchFieldsTestCase method testRequireThatUntransformedSummaryFieldsAreIgnored.
@Test
public void testRequireThatUntransformedSummaryFieldsAreIgnored() throws IOException, ParseException {
Search search = SearchBuilder.buildFromFile("src/test/examples/nextgen/untransformedsummaryfields.sd");
assertNotNull(search);
SDDocumentType docType = search.getDocument();
assertNotNull(docType);
assertNotNull(docType.getField("rankfeatures"));
assertNotNull(docType.getField("summaryfeatures"));
assertNotNull(docType.getField("foo"));
assertNotNull(docType.getField("bar"));
assertNotNull(docType.getField("baz"));
assertEquals(5, docType.getFieldCount());
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class EmptyRankProfileTestCase method testDeriving.
@Test
public void testDeriving() {
Search search = new Search("test", null);
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search);
SDDocumentType doc = new SDDocumentType("test");
search.addDocument(doc);
doc.addField(new SDField("a", DataType.STRING));
SDField field = new SDField("b", DataType.STRING);
field.setLiteralBoost(500);
doc.addField(field);
doc.addField(new SDField("c", DataType.STRING));
search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry());
new DerivedConfiguration(search, rankProfileRegistry, new QueryProfileRegistry());
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class IdTestCase method testExplicitUpperCaseIdField.
@Test
@SuppressWarnings({ "deprecation" })
public void testExplicitUpperCaseIdField() {
Search search = new Search("test", null);
SDDocumentType document = new SDDocumentType("test");
search.addDocument(document);
SDField uri = new SDField("URI", DataType.URI);
uri.parseIndexingScript("{ summary | index }");
document.addField(uri);
Processing.process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true);
assertNull(document.getField("uri"));
assertNull(document.getField("Uri"));
assertNotNull(document.getField("URI"));
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class AttributeListTestCase method testDeriving.
@Test
public void testDeriving() throws IOException, ParseException {
// Test attribute importing
Search search = SearchBuilder.buildFromFile("src/test/examples/simple.sd");
// Test attribute deriving
AttributeFields attributeFields = new AttributeFields(search);
Iterator attributes = attributeFields.attributeIterator();
Attribute attribute;
attribute = (Attribute) attributes.next();
assertEquals("popularity", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
attribute = (Attribute) attributes.next();
assertEquals("measurement", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
attribute = (Attribute) attributes.next();
assertEquals("smallattribute", attribute.getName());
assertEquals(Attribute.Type.BYTE, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
attribute = (Attribute) attributes.next();
assertEquals("access", attribute.getName());
assertEquals(Attribute.Type.BYTE, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
attribute = (Attribute) attributes.next();
assertEquals("category_arr", attribute.getName());
assertEquals(Attribute.Type.STRING, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
attribute = (Attribute) attributes.next();
assertEquals("measurement_arr", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
attribute = (Attribute) attributes.next();
assertEquals("popsiness", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
assertTrue(!attributes.hasNext());
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class CasingTestCase method testCasing.
@Test
public void testCasing() throws IOException, ParseException {
Search search = SearchBuilder.buildFromFile("src/test/examples/casing.sd");
assertEquals(search.getIndex("color").getName(), "color");
assertEquals(search.getIndex("Foo").getName(), "Foo");
assertEquals(search.getIndex("Price").getName(), "Price");
assertEquals(search.getAttribute("artist").getName(), "artist");
assertEquals(search.getAttribute("Drummer").getName(), "Drummer");
assertEquals(search.getAttribute("guitarist").getName(), "guitarist");
assertEquals(search.getAttribute("title").getName(), "title");
assertEquals(search.getAttribute("Trumpetist").getName(), "Trumpetist");
assertEquals(search.getAttribute("Saxophonist").getName(), "Saxophonist");
assertEquals(search.getAttribute("TenorSaxophonist").getName(), "TenorSaxophonist");
assertEquals(search.getAttribute("Flutist").getName(), "Flutist");
}
Aggregations