use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class AttributePropertiesTestCase method testInvalidAttributeProperties.
@Test
public void testInvalidAttributeProperties() throws IOException, ParseException {
try {
Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeproperties1.sd");
new AttributeProperties(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
fail("attribute property should not be set");
} catch (RuntimeException e) {
// empty
}
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class AttributePropertiesTestCase method testValidAttributeProperties.
@Test
public void testValidAttributeProperties() throws IOException, ParseException {
Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeproperties2.sd");
new AttributeProperties(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class ImplicitSearchFieldsTestCase method testRequireThatDynamicSummaryFieldsAreIgnored.
@Test
public void testRequireThatDynamicSummaryFieldsAreIgnored() throws IOException, ParseException {
Search search = SearchBuilder.buildFromFile("src/test/examples/nextgen/dynamicsummaryfields.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"));
assertEquals(4, docType.getFieldCount());
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class ImplicitSearchFieldsTestCase method testRequireThatExtraFieldsAreIncluded.
@Test
public void testRequireThatExtraFieldsAreIncluded() throws IOException, ParseException {
Search search = SearchBuilder.buildFromFile("src/test/examples/nextgen/extrafield.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"));
assertEquals(4, docType.getFieldCount());
}
use of com.yahoo.searchdefinition.Search in project vespa by vespa-engine.
the class SearchClusterTest method testSdConfigLogical.
@Test
public void testSdConfigLogical() throws IOException, SAXException {
// sd1
SDDocumentType sdt1 = new SDDocumentType("s1");
Search search1 = new Search("s1", null);
SDField f1 = new SDField("f1", DataType.STRING);
f1.addAttribute(new Attribute("f1", DataType.STRING));
f1.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f1"))));
sdt1.addField(f1);
search1.addDocument(sdt1);
// sd2
SDDocumentType sdt2 = new SDDocumentType("s2");
Search search2 = new Search("s2", null);
SDField f2 = new SDField("f2", DataType.STRING);
f2.addAttribute(new Attribute("f2", DataType.STRING));
f2.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f2"))));
sdt2.addField(f2);
search2.addDocument(sdt2);
SearchBuilder builder = new SearchBuilder();
builder.importRawSearch(search1);
builder.importRawSearch(search2);
builder.build();
}
Aggregations