@Override public void setProperty(String key, String value) { ApplicationSetup.setProperty(key, value); }
@Override public void setProperty(String key, String value) { ApplicationSetup.setProperty(key, value); }
/** set a property value only if it has not already been set * @param propertyKey the name of the property to set. * @param defaultValue the value of the property to set. */ public static void setDefaultProperty(String propertyKey, String defaultValue) { if (getProperty(propertyKey,null) != null) setProperty(propertyKey, defaultValue); }
protected Index createIndex() throws Exception { ApplicationSetup.setProperty("indexer.meta.forward.keys", "filename"); ApplicationSetup.setProperty("indexer.meta.reverse.keys", ""); ApplicationSetup.setProperty("termpipelines", ""); Index index = IndexTestUtils.makeIndex( new String[]{"doc1", "doc2"}, new String[]{"The quick brown fox jumps over the lazy dog", "foxes"}); return index; }
@Before public void setIndexerProperties() { ApplicationSetup.setProperty("indexer.meta.forward.keys", "filename"); ApplicationSetup.setProperty("indexer.meta.reverse.keys", ""); ApplicationSetup.setProperty("termpipelines", ""); }
protected Index createIndex() throws Exception { ApplicationSetup.setProperty("indexer.meta.forward.keys", "filename"); ApplicationSetup.setProperty("indexer.meta.reverse.keys", ""); ApplicationSetup.setProperty("termpipelines", ""); Index index = IndexTestUtils.makeIndex( new String[]{"doc1", "doc2"}, new String[]{"The quick brown fox jumps over the lazy dog", "foxes"}); return index; }
@Override protected void addDirectStructure(IndexOnDisk index) throws Exception { ApplicationSetup.setProperty("inverted2direct.processtokens", "4272"); super.addDirectStructure(index); } }
@After public void tearDown() { docids = documents = null; docs1 = null; collection = null; ApplicationSetup.setProperty("FieldTags.process", ""); } }
@Test(expected=IllegalArgumentException.class) public void testConfiguration() { ApplicationSetup.setProperty("TrecDocTags.process", "TEXT"); ApplicationSetup.setProperty("TrecDocTags.skip", "TEXT"); new TagSet(TagSet.TREC_DOC_TAGS); } }
@Override protected void addDirectStructure(IndexOnDisk index) throws Exception { ApplicationSetup.setProperty("inverted2direct.processtokens", "4272"); super.addDirectStructure(index); } }
@Test public void testAbstractCreation_noroottag() { ApplicationSetup.setProperty("TrecDocTags.process", ""); ApplicationSetup.setProperty("TaggedDocument.abstracts", "body"); ApplicationSetup.setProperty("TaggedDocument.abstracts.tags", "ELSE"); ApplicationSetup.setProperty("TaggedDocument.abstracts.lengths", "11"); Document d; d = makeDocument( "test\n", ENGLISH_TOKENISER); while(! d.endOfDocument()) d.getNextTerm(); assertEquals("test", d.getProperty("body")); }
@Test public void testAbstractCreationTitleCropped() { //ApplicationSetup.setProperty("TrecDocTags.process", "TITLE,TEXT"); ApplicationSetup.setProperty("TaggedDocument.abstracts", "TITLE"); ApplicationSetup.setProperty("TaggedDocument.abstracts.tags", "TITLE"); ApplicationSetup.setProperty("TaggedDocument.abstracts.lengths", "11"); Document d = makeDocument( "<TITLE>No 'title' LIKE THIS title</TITLE>\n"+ "<TEXT>test</TEXT>\n", ENGLISH_TOKENISER); while(! d.endOfDocument()) d.getNextTerm(); assertEquals("No 'title'", d.getProperty("TITLE")); }
@Test public void testNicSp() throws Exception { ApplicationSetup.setProperty("termpipelines", ""); Index index = IndexTestUtils.makeIndexSinglePass(DOCNOS_TEST_NIC, DOCS_TEST_NIC); checkFrequencies(index); }
@Test public void testBasicFields() throws Exception { ApplicationSetup.setProperty("FieldTags.process", "TITLE,ELSE"); testIndexer(new BasicIndexer(ApplicationSetup.TERRIER_INDEX_PATH, "fields"), true, true); }
@Test public void testBlockFields() throws Exception { ApplicationSetup.setProperty("FieldTags.process", "TITLE,ELSE"); testIndexer(new BlockIndexer(ApplicationSetup.TERRIER_INDEX_PATH, "fields"), true, true); }
@Test public void testBlockSPNoFields() throws Exception { ApplicationSetup.setProperty("FieldTags.process", ""); testIndexer(new BlockSinglePassIndexer(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX), false, false); } @Test
@Test public void testFields() { ApplicationSetup.setProperty("FieldTags.process", "title,body"); testDocument(makeDocument("<title> a </title> <body> b </body> <b> c </b> ", ENGLISH_TOKENISER), "a:TITLE", "b:BODY", "c"); }
@Test public void testSpaceInTagBodies() { ApplicationSetup.setProperty("TrecDocTags.process", "body" ); testDocument(makeDocument("<reda><body>hello</body></reda>", ENGLISH_TOKENISER), "hello" ); testDocument(makeDocument("<reda ><body>hello</body></reda>", ENGLISH_TOKENISER), "hello" ); }
@Test public void testNoBlocks() throws Exception { String mydoc = "hello there"; ApplicationSetup.setProperty("termpipelines", ""); Index index = IndexTestUtils.makeIndex(new String[]{"doc1"}, new String[]{mydoc}); ApplicationSetup.TERRIER_INDEX_PATH = ((IndexOnDisk)index).getPath(); ApplicationSetup.TERRIER_INDEX_PREFIX = ((IndexOnDisk)index).getPrefix(); new ShowDocumentCommand().run(new String[]{"--docid", "0"}); }
public static ResultSet query(String query,Index index) { ApplicationSetup.setProperty("ignore.low.idf.terms", "false"); Manager mgr = new LocalManager(index); assertNotNull(mgr); SearchRequest srq = mgr.newSearchRequest(query, query); assertNotNull(srq); srq.setControl(SearchRequest.CONTROL_WMODEL, "TF_IDF"); mgr.runSearchRequest(srq); ResultSet result = ((Request) srq).getResultSet(); assertNotNull(result); return result; }