public virtual void TestInclusiveLowerNull() { //http://issues.apache.org/jira/browse/LUCENE-38 Analyzer analyzer = new SingleCharAnalyzer(); Query query = new TermRangeQuery("content", null, "C", true, true); InitializeIndex(new System.String[] { "A", "B", "", "C", "D" }, analyzer); IndexSearcher searcher = new IndexSearcher(dir); Hits hits = searcher.Search(query); // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(4, hits.Length(), "A,B,<empty string>,C,D => A,B,<empty string>,C in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(3, hits.length(), "A,B,<empty string>,C,D => A,B,<empty string>,C in range"); searcher.Close(); InitializeIndex(new System.String[] { "A", "B", "", "D" }, analyzer); searcher = new IndexSearcher(dir); hits = searcher.Search(query); // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, hits.Length(), "A,B,<empty string>,D - A, B and <empty string> in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(2, hits.length(), "A,B,<empty string>,D => A, B and <empty string> in range"); searcher.Close(); AddDoc("C"); searcher = new IndexSearcher(dir); hits = searcher.Search(query); // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(4, hits.Length(), "C added => A,B,<empty string>,C in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(3, hits.length(), "C added => A,B,<empty string>,C in range"); searcher.Close(); }
public virtual void TestInclusiveLowerNull() { //http://issues.apache.org/jira/browse/LUCENE-38 Analyzer analyzer = new SingleCharAnalyzer(); Query query = TermRangeQuery.NewStringRange("content", null, "C", true, true); InitializeIndex(new string[] { "A", "B", "", "C", "D" }, analyzer); IndexReader reader = DirectoryReader.Open(Dir); IndexSearcher searcher = NewSearcher(reader); int numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(4, numHits, "A,B,<empty string>,C,D => A,B,<empty string>,C in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(3, hits.Length(), "A,B,<empty string>,C,D => A,B,<empty string>,C in range"); reader.Dispose(); InitializeIndex(new string[] { "A", "B", "", "D" }, analyzer); reader = DirectoryReader.Open(Dir); searcher = NewSearcher(reader); numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "A,B,<empty string>,D - A, B and <empty string> in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(2, hits.Length(), "A,B,<empty string>,D => A, B and <empty string> in range"); reader.Dispose(); AddDoc("C"); reader = DirectoryReader.Open(Dir); searcher = NewSearcher(reader); numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(4, numHits, "C added => A,B,<empty string>,C in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(3, hits.Length(), "C added => A,B,<empty string>,C in range"); reader.Dispose(); }
public virtual void TestExclusiveLowerNull() { Analyzer analyzer = new SingleCharAnalyzer(); //http://issues.apache.org/jira/browse/LUCENE-38 Query query = new TermRangeQuery("content", null, "C", false, false); InitializeIndex(new System.String[] { "A", "B", "", "C", "D" }, analyzer); IndexSearcher searcher = new IndexSearcher(dir, true); int numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "A,B,<empty string>,C,D => A, B & <empty string> are in range"); // until Lucene-38 is fixed, use this assert: //Assert.AreEqual(2, hits.length(),"A,B,<empty string>,C,D => A, B & <empty string> are in range"); searcher.Close(); InitializeIndex(new System.String[] { "A", "B", "", "D" }, analyzer); searcher = new IndexSearcher(dir, true); numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "A,B,<empty string>,D => A, B & <empty string> are in range"); // until Lucene-38 is fixed, use this assert: //Assert.AreEqual(2, hits.length(), "A,B,<empty string>,D => A, B & <empty string> are in range"); searcher.Close(); AddDoc("C"); searcher = new IndexSearcher(dir, true); numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "C added, still A, B & <empty string> are in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(2, hits.length(), "C added, still A, B & <empty string> are in range"); searcher.Close(); }
public virtual void TestInclusiveLowerNull() { //http://issues.apache.org/jira/browse/LUCENE-38 Analyzer analyzer = new SingleCharAnalyzer(); Query query = new TermRangeQuery("content", null, "C", true, true); InitializeIndex(new System.String[]{"A", "B", "", "C", "D"}, analyzer); IndexSearcher searcher = new IndexSearcher(dir); Hits hits = searcher.Search(query); // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(4, hits.Length(), "A,B,<empty string>,C,D => A,B,<empty string>,C in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(3, hits.length(), "A,B,<empty string>,C,D => A,B,<empty string>,C in range"); searcher.Close(); InitializeIndex(new System.String[]{"A", "B", "", "D"}, analyzer); searcher = new IndexSearcher(dir); hits = searcher.Search(query); // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, hits.Length(), "A,B,<empty string>,D - A, B and <empty string> in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(2, hits.length(), "A,B,<empty string>,D => A, B and <empty string> in range"); searcher.Close(); AddDoc("C"); searcher = new IndexSearcher(dir); hits = searcher.Search(query); // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(4, hits.Length(), "C added => A,B,<empty string>,C in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(3, hits.length(), "C added => A,B,<empty string>,C in range"); searcher.Close(); }
public virtual void TestExclusiveLowerNull() { Analyzer analyzer = new SingleCharAnalyzer(); //http://issues.apache.org/jira/browse/LUCENE-38 Query query = new TermRangeQuery("content", null, "C", false, false); InitializeIndex(new System.String[]{"A", "B", "", "C", "D"}, analyzer); IndexSearcher searcher = new IndexSearcher(dir, true); int numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "A,B,<empty string>,C,D => A, B & <empty string> are in range"); // until Lucene-38 is fixed, use this assert: //Assert.AreEqual(2, hits.length(),"A,B,<empty string>,C,D => A, B & <empty string> are in range"); searcher.Close(); InitializeIndex(new System.String[]{"A", "B", "", "D"}, analyzer); searcher = new IndexSearcher(dir, true); numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "A,B,<empty string>,D => A, B & <empty string> are in range"); // until Lucene-38 is fixed, use this assert: //Assert.AreEqual(2, hits.length(), "A,B,<empty string>,D => A, B & <empty string> are in range"); searcher.Close(); AddDoc("C"); searcher = new IndexSearcher(dir, true); numHits = searcher.Search(query, null, 1000).TotalHits; // When Lucene-38 is fixed, use the assert on the next line: Assert.AreEqual(3, numHits, "C added, still A, B & <empty string> are in range"); // until Lucene-38 is fixed, use this assert //Assert.AreEqual(2, hits.length(), "C added, still A, B & <empty string> are in range"); searcher.Close(); }