override public void  Run()
 {
     try
     {
         docs = (sort == null)?searchable.Search(query, filter, nDocs):searchable.Search(query, filter, nDocs, sort);
     }
     // Store the IOException for later use by the caller of this thread
     catch (System.IO.IOException ioe)
     {
         this.ioe = ioe;
     }
     if (this.ioe == null)
     {
         // if we are sorting by fields, we need to tell the Field sorted hit queue
         // the actual type of fields, in case the original list contained AUTO.
         // if the searchable returns null for fields, we'll have problems.
         if (sort != null)
         {
             ((FieldDocSortedHitQueue)hq).SetFields(((TopFieldDocs)docs).fields);
         }
         ScoreDoc[] scoreDocs = docs.scoreDocs;
         for (int j = 0; j < scoreDocs.Length; j++)
         {
             // merge scoreDocs into hq
             ScoreDoc scoreDoc = scoreDocs[j];
             scoreDoc.doc += starts[i]; // convert doc
             //it would be so nice if we had a thread-safe insert
             lock (hq)
             {
                 if (!hq.Insert(scoreDoc))
                 {
                     break;
                 }
             } // no more scores > minScore
         }
     }
 }
Exemple #2
0
 public virtual void  Search(Query query, Filter filter, HitCollector results)
 {
     local.Search(query, filter, results);
 }