lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jacky" <>
Subject IndexSearcher executed concurrently
Date Tue, 05 Sep 2006 09:57:07 GMT
   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 =;
          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.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message