lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Groschupf ...@media-style.com>
Subject Re: search multiple indexes
Date Thu, 01 Jul 2004 23:21:01 GMT
> http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/search/ 
> MultiSearcher.html
>
100% Right.
I personal found code samples more interesting then just java doc.
That why my hint, here the code snippet from nutch:

/** Construct given a number of indexed segments. */
   public IndexSearcher(File[] segmentDirs) throws IOException {
     NutchSimilarity sim = new NutchSimilarity();
     Searchable[] searchables = new Searchable[segmentDirs.length];
     segmentNames = new String[segmentDirs.length];
     for (int i = 0; i < segmentDirs.length; i++) {
       org.apache.lucene.search.Searcher searcher =
         new org.apache.lucene.search.IndexSearcher
         (new File(segmentDirs[i], "index").toString());
       searcher.setSimilarity(sim);
       searchables[i] = searcher;
       segmentNames[i] = segmentDirs[i].getName();
     }
     this.luceneSearcher = new MultiSearcher(searchables);
     this.luceneSearcher.setSimilarity(sim);
   }

Kent Beck said: "Monkey see, Monkey do." ;-)

Cheers,
Stefan

---------------------------------------------------------------
enterprise information technology consulting
open technology:   http://www.media-style.com
open source:           http://www.weta-group.net
open discussion:    http://www.text-mining.org


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


Mime
View raw message