lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-lucene/src/test/org/apache/lucene/search TestFilteredQuery.java
Date Sat, 08 May 2004 15:06:19 GMT
ehatcher    2004/05/08 08:06:19

  Modified:    src/test/org/apache/lucene/search TestFilteredQuery.java
  Log:
  expected, then actual :)  also, uncovered a bug in FilteredQuery, a rewrite is needed somewhere
  
  Revision  Changes    Path
  1.2       +21 -9     jakarta-lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java
  
  Index: TestFilteredQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestFilteredQuery.java	21 Apr 2004 19:18:44 -0000	1.1
  +++ TestFilteredQuery.java	8 May 2004 15:06:19 -0000	1.2
  @@ -95,24 +95,36 @@
     throws Exception {
       Query filteredquery = new FilteredQuery (query, filter);
       Hits hits = searcher.search (filteredquery);
  -    assertEquals (hits.length(), 1);
  -    assertEquals (hits.id(0), 1);
  +    assertEquals (1, hits.length());
  +    assertEquals (1, hits.id(0));
   
       hits = searcher.search (filteredquery, new Sort("sorter"));
  -    assertEquals (hits.length(), 1);
  -    assertEquals (hits.id(0), 1);
  +    assertEquals (1, hits.length());
  +    assertEquals (1, hits.id(0));
   
       filteredquery = new FilteredQuery (new TermQuery (new Term ("field", "one")), filter);
       hits = searcher.search (filteredquery);
  -    assertEquals (hits.length(), 2);
  +    assertEquals (2, hits.length());
   
       filteredquery = new FilteredQuery (new TermQuery (new Term ("field", "x")), filter);
       hits = searcher.search (filteredquery);
  -    assertEquals (hits.length(), 1);
  -    assertEquals (hits.id(0), 3);
  +    assertEquals (1, hits.length());
  +    assertEquals (3, hits.id(0));
   
       filteredquery = new FilteredQuery (new TermQuery (new Term ("field", "y")), filter);
       hits = searcher.search (filteredquery);
  -    assertEquals (hits.length(), 0);
  +    assertEquals (0, hits.length());
     }
  +
  +  public void testRangeQuery() throws Exception {
  +    RangeQuery rq = new RangeQuery(
  +        new Term("sorter", "b"), new Term("sorter", "d"), true);
  +
  +    // rq = rq.rewrite(searcher.reader) // makes the test pass
  +
  +    Query filteredquery = new FilteredQuery(rq, filter);
  +    Hits hits = searcher.search(filteredquery);
  +    assertEquals(2, hits.length());
  +  }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message