lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jacky" <jackych...@gmail.com>
Subject IndexSearcher executed concurrently
Date Tue, 05 Sep 2006 09:57:07 GMT
hi,
   The source code in the end is the class to search sth. 
   1. I wander if concurrent users can get the right results with different queries since
the class has only one IndexSearcher instance. 
   2. As we know, a new IndexSearcher can be created when user request his query. If first
method gets the right
result, so, which method can get better performance. 

   public class MySearcher{
      private Searcher indexSearcher = new IndexSearcher("indexPath");
      private QueryParser parser = new QueryParser("content", new StandardAnalyzer());

      public Document[] search(String queryLine){ 
          Hits hits = indexSearcher.search(parser.parse(queryLine));
          Document docs = new Document[hits.length()];
          for(int i = 0; i < hits.length(); i ++){
             docs[i] = hits.doc(i);
          }
          return docs;
      } 

    Thanks for you help!  
 
     Best Regards.
       jacky  
       
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message