use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.
the class FastSearcherTestCase method createFastSearcher.
private FastSearcher createFastSearcher() {
mockBackend = new MockBackend();
ConfigGetter<DocumentdbInfoConfig> getter = new ConfigGetter<>(DocumentdbInfoConfig.class);
DocumentdbInfoConfig config = getter.getConfig("file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg");
MockFSChannel.resetDocstamp();
Logger.getLogger(FastSearcher.class.getName()).setLevel(Level.ALL);
return new FastSearcher(mockBackend, new FS4ResourcePool(1), new MockDispatcher(Collections.emptyList()), new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(100, 1e64), config);
}
use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.
the class ParsingTester method createIndexFacts.
/**
* Returns an unfrozen version of the IndexFacts this will use.
* This can be used to add new indexes and passing the resulting IndexFacts to the constructor of this.
*/
public static IndexFacts createIndexFacts() {
String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/query/parser/test/parseindexinfo.cfg";
ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
IndexInfoConfig config = getter.getConfig(indexInfoConfigID);
return new IndexFacts(new IndexModel(config, (QrSearchersConfig) null));
}
use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.
the class SplitterJoinerTestCase method testSplitJoin.
@Test
public void testSplitJoin() {
ConfigGetter<SplitterJoinerDocumentProcessorConfig> getter = new ConfigGetter<>(SplitterJoinerDocumentProcessorConfig.class);
ConfigGetter<DocumentmanagerConfig> docManGetter = new ConfigGetter<>(DocumentmanagerConfig.class);
SplitterJoinerDocumentProcessorConfig cfg = getter.getConfig("file:src/test/java/com/yahoo/docproc/util/splitter-joiner-document-processor.cfg");
DocumentmanagerConfig docManCfg = docManGetter.getConfig("file:src/test/java/com/yahoo/docproc/util/documentmanager.docindoc.cfg");
SplitterDocumentProcessor splitter = new SplitterDocumentProcessor(cfg, docManCfg);
DocumentTypeManager manager = splitter.manager;
/**
** Create documents: ***
*/
Document inner1 = new Document(manager.getDocumentType("docindoc"), "doc:inner:number:one");
inner1.setFieldValue("name", new StringFieldValue("Donald Duck"));
inner1.setFieldValue("content", new StringFieldValue("Lives in Duckburg"));
Document inner2 = new Document(manager.getDocumentType("docindoc"), "doc:inner:number:two");
inner2.setFieldValue("name", new StringFieldValue("Uncle Scrooge"));
inner2.setFieldValue("content", new StringFieldValue("Lives in Duckburg, too."));
Array<Document> innerArray = (Array<Document>) manager.getDocumentType("outerdoc").getField("innerdocuments").getDataType().createFieldValue();
innerArray.add(inner1);
innerArray.add(inner2);
Document outer = new Document(manager.getDocumentType("outerdoc"), "doc:outer:the:only:one");
outer.setFieldValue("innerdocuments", innerArray);
/**
** End create documents ***
*/
Processing p = Processing.of(new DocumentPut(outer));
splitter.process(p);
assertEquals(2, p.getDocumentOperations().size());
assertThat(((DocumentPut) (p.getDocumentOperations().get(0))).getDocument(), sameInstance(inner1));
assertThat(((DocumentPut) (p.getDocumentOperations().get(1))).getDocument(), sameInstance(inner2));
assertThat(((DocumentPut) (p.getVariable(cfg.contextFieldName()))).getDocument(), sameInstance(outer));
assertThat(outer.getFieldValue("innerdocuments"), sameInstance(innerArray));
assertTrue(innerArray.isEmpty());
JoinerDocumentProcessor joiner = new JoinerDocumentProcessor(cfg, docManCfg);
joiner.process(p);
assertThat(p.getDocumentOperations().size(), equalTo(1));
assertThat(((DocumentPut) p.getDocumentOperations().get(0)).getDocument(), sameInstance(outer));
assertThat(p.getVariable(cfg.contextFieldName()), nullValue());
assertThat(outer.getFieldValue("innerdocuments"), sameInstance(innerArray));
assertThat(innerArray.size(), equalTo(2));
assertThat(innerArray.get(0), sameInstance(inner1));
assertThat(innerArray.get(1), sameInstance(inner2));
}
use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.
the class VdsStreamingSearcherTestCase method testBasics.
@Test
public void testBasics() {
MockVisitorFactory factory = new MockVisitorFactory();
VdsStreamingSearcher searcher = new VdsStreamingSearcher(factory);
ConfigGetter<DocumentdbInfoConfig> getter = new ConfigGetter<>(DocumentdbInfoConfig.class);
DocumentdbInfoConfig config = getter.getConfig("file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg");
searcher.init(new SummaryParameters("default"), new ClusterParams("clusterName"), new CacheParams(100, 1e64), config);
// Magic query values are used to trigger specific behaviors from mock visitor.
checkError(searcher, "/?query=noselection", "Backend communication error", "Streaming search needs one and only one");
checkError(searcher, "/?streaming.userid=1&query=parseexception", "Backend communication error", "Failed to parse document selection string");
checkError(searcher, "/?streaming.userid=1&query=tokenizeexception", "Backend communication error", "Failed to tokenize document selection string");
checkError(searcher, "/?streaming.userid=1&query=interruptedexception", "Backend communication error", "Interrupted");
checkError(searcher, "/?streaming.userid=1&query=timeoutexception", "Timed out", "Timed out");
checkError(searcher, "/?streaming.userid=1&query=illegalargumentexception", "Backend communication error", "Illegal argument");
checkError(searcher, "/?streaming.userid=1&query=nosummary", "Backend communication error", "Did not find summary for hit with document id");
checkError(searcher, "/?streaming.userid=1&query=nosummarytofill", "Timed out", "Missing hit summary data for 1 hits");
checkSearch(searcher, "/?streaming.userid=1&query=oneuserhit", 1, USERDOC_ID_PREFIX);
checkSearch(searcher, "/?streaming.userid=1&query=oneuserhit&sorting=%2Bsurname", 1, USERDOC_ID_PREFIX);
checkSearch(searcher, "/?streaming.selection=id.user%3D%3d1&query=twouserhits", 2, USERDOC_ID_PREFIX);
checkSearch(searcher, "/?streaming.groupname=group1&query=twogrouphitsandoneuserhit", 2, GROUPDOC_ID_PREFIX);
checkGrouping(searcher, "/?streaming.selection=true&query=onegroupinghit", 1);
}
use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.
the class StemmingSearcherTestCase method testEmptyIndexInfo.
@Test
public void testEmptyIndexInfo() {
String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/querytransform/test/emptyindexinfo.cfg";
ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
IndexInfoConfig config = getter.getConfig(indexInfoConfigID);
IndexFacts indexFacts = new IndexFacts(new IndexModel(config, (QrSearchersConfig) null));
Query q = new Query(QueryTestCase.httpEncode("?query=cars"));
new Execution(new Chain<Searcher>(new StemmingSearcher(linguistics)), new Execution.Context(null, indexFacts, null, null, linguistics)).search(q);
assertEquals("cars", q.getModel().getQueryTree().getRoot().toString());
}
Aggregations