DirectIndexRef(Index i) { super(i.toString());//THIS IS A HACK this.underlyingIndex = i; } }
DirectIndexRef(Index i) { super(i.toString());//THIS IS A HACK this.underlyingIndex = i; } }
/** * main * * @param args */ public static void main(String[] args) { Index index = Index.createIndex(); System.out.println("Index " + index.toString()); }
/** * main * * @param args */ public static void main(String[] args) { Index index = Index.createIndex(); System.out.println("Index " + index.toString()); }
protected ResultSet _testOneDocumentTwoTermsNegativeMatch() throws Exception { Index index = IndexTestUtils.makeIndex( new String[]{"doc1", "doc2"}, new String[]{ "The quick brown fox jumps over the lazy dog", "how much is that dog in the window"}); System.err.println("testTwoDocumentsNegativeMatch: " + index.toString()); assertNotNull(index); assertEquals(2, index.getCollectionStatistics().getNumberOfDocuments()); Manager matching = new LocalManager(index); assertNotNull(matching); ResultSet rs; SearchRequest search = matching.newSearchRequest("test", "dog -window"); search.setControl(SearchRequest.CONTROL_WMODEL, DPH.class.getName()); //search.addMatchingModel("Matching", "DPH"); search.setOriginalQuery("dog -window"); matching.runSearchRequest(search); rs = ((Request)search).getResultSet(); assertNotNull(rs); assertEquals(1, rs.getResultSize()); TIntHashSet docids = new TIntHashSet(rs.getDocids()); System.err.println("" + rs.getDocids()[0] + " "+ rs.getScores()[0]); assertTrue(docids.contains(0)); assertEquals(0, rs.getDocids()[0]); assertTrue(rs.getScores()[0] > 0); return rs; }
"The quick brown fox jumps over the lazy dog", "how much is that dog in the window"}); System.err.println("testTwoDocumentsNegativeMatch: " + index.toString()); assertNotNull(index); assertEquals(2, index.getCollectionStatistics().getNumberOfDocuments());
protected ResultSet _testSingleDocumentIndexMatching() throws Exception { Index index = IndexTestUtils.makeIndex( new String[]{"doc1"}, new String[]{"The quick brown fox jumps over the lazy dog"}); System.err.println("testSingleDocumentIndexMatching: " + index.toString()); assertNotNull(index); assertEquals(1, index.getCollectionStatistics().getNumberOfDocuments()); Matching matching = makeMatching(index); assertNotNull(matching); MatchingQueryTerms mqt = new MatchingQueryTerms(); mqt.setTermProperty("quick", 1); mqt.setDefaultTermWeightingModel(new DLH13()); ResultSet rs = matching.match("query1", mqt); assertNotNull(mqt.getStatistics("quick")); assertNotNull(rs); assertEquals(1, rs.getResultSize()); assertEquals(0, rs.getDocids()[0]); assertTrue(rs.getScores()[0] > 0); return rs; }
protected ResultSet _testMatchingNonStatisticsOverwrite() throws Exception { Index index = IndexTestUtils.makeIndex( new String[]{"doc1"}, new String[]{"The quick brown fox jumps over the lazy dog"}); assertNotNull(index); System.err.println("testMatchingNonStatisticsOverwrite: " + index.toString()); assertEquals(1, index.getCollectionStatistics().getNumberOfDocuments()); Matching matching = makeMatching(index); assertNotNull(matching); MatchingQueryTerms mqt = new MatchingQueryTerms(); LexiconEntry le = index.getLexicon().getLexiconEntry("quick"); assertNotNull(le); le.setStatistics(1, 40); mqt.setTermProperty("quick", le); mqt.setDefaultTermWeightingModel(new DLH13()); ResultSet rs = matching.match("query1", mqt); assertNotNull(rs); assertEquals(1, rs.getResultSize()); assertEquals(0, rs.getDocids()[0]); //check that statistics havent been overwritten assertEquals(40, mqt.getStatistics("quick").getFrequency()); return rs; }
"how much is that dog in the window", "the one with the waggily tail"}); System.err.println("testThreeDocumentsSynonymIndexMatching: " + index.toString()); assertNotNull(index); assertEquals(3, index.getCollectionStatistics().getNumberOfDocuments());
"The quick brown fox jumps over the lazy dog", "how much is that dog in the window"}); System.err.println("testThreeDocumentsSynonymIndexMatching: " + index.toString()); assertNotNull(index); assertEquals(2, index.getCollectionStatistics().getNumberOfDocuments());
"The quick brown fox jumps over the lazy dog", "how much is that dog in the window"}); System.err.println("testTwoDocumentsIndexMatching: " + index.toString()); assertNotNull(index); assertEquals(2, index.getCollectionStatistics().getNumberOfDocuments());
"<DOCNO>3</DOCNO> <TITLE> Simple dog example 2 </TITLE> <BODY> For example, what type of terrier is it? </BODY>", "<DOCNO>4</DOCNO> <TITLE> Copyright Statement </TITLE> <BODY> Terrier.org </BODY>"}); System.err.println("testTwoDocumentsFieldIndexMatching: " + index.toString()); assertNotNull(index); assertEquals(4, index.getCollectionStatistics().getNumberOfDocuments());
new String[]{"doc1"}, new String[]{"The <TITLE>quick brown</TITLE> fox jumps over the lazy dog"}); System.err.println("_testSingleDocumentIndexMatchingFields: " + index.toString()); assertNotNull(index); assertEquals(1, index.getCollectionStatistics().getNumberOfDocuments());