lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject cvs commit: jakarta-lucene/src/test/org/apache/lucene/search TestRemoteSearchable.java
Date Tue, 16 Sep 2003 12:49:30 GMT
otis        2003/09/16 05:49:30

  Modified:    src/test/org/apache/lucene/search TestRemoteSearchable.java
  Log:
  - Added testQueryFilter test for bug 20290
    http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290
  - Made search(Query) private.
  
  Revision  Changes    Path
  1.5       +19 -6     jakarta-lucene/src/test/org/apache/lucene/search/TestRemoteSearchable.java
  
  Index: TestRemoteSearchable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/search/TestRemoteSearchable.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestRemoteSearchable.java	29 Jan 2003 17:43:13 -0000	1.4
  +++ TestRemoteSearchable.java	16 Sep 2003 12:49:30 -0000	1.5
  @@ -79,7 +79,7 @@
         return lookupRemote();
       }
     }
  -  
  +
     private static Searchable lookupRemote() throws Exception {
       return (Searchable)Naming.lookup("//localhost/Searchable");
     }
  @@ -101,7 +101,7 @@
       Naming.rebind("//localhost/Searchable", impl);
     }
   
  -  public static void search(Query query) throws Exception {
  +  private static void search(Query query) throws Exception {
       // try to search the published index
       Searchable[] searchables = { getRemote() };
       Searcher searcher = new MultiSearcher(searchables);
  @@ -110,22 +110,35 @@
       assertEquals(1, result.length());
       assertEquals("test text", result.doc(0).get("test"));
     }
  -  
  -  public void testTermQuery() throws Exception { 
  +
  +  public void testTermQuery() throws Exception {
       search(new TermQuery(new Term("test", "test")));
     }
   
  -  public void testBooleanQuery() throws Exception { 
  +  public void testBooleanQuery() throws Exception {
       BooleanQuery query = new BooleanQuery();
       query.add(new TermQuery(new Term("test", "test")), true, false);
       search(query);
     }
   
  -  public void testPhraseQuery() throws Exception { 
  +  public void testPhraseQuery() throws Exception {
       PhraseQuery query = new PhraseQuery();
       query.add(new Term("test", "test"));
       query.add(new Term("test", "text"));
       search(query);
     }
   
  +  // Tests bug fix at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290
  +  public void testQueryFilter() throws Exception {
  +    // try to search the published index
  +    Searchable[] searchables = { getRemote() };
  +    Searcher searcher = new MultiSearcher(searchables);
  +    Hits hits = searcher.search(
  +          new TermQuery(new Term("test", "text")),
  +          new QueryFilter(new TermQuery(new Term("test", "test"))));
  +    Hits nohits = searcher.search(
  +          new TermQuery(new Term("test", "text")),
  +          new QueryFilter(new TermQuery(new Term("test", "non-existent-term"))));
  +    assertEquals(0, nohits.length());
  +  }
   }
  
  
  

Mime
View raw message