You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2007/10/25 08:56:43 UTC

[Lucene-java Wiki] Update of "LuceneFAQ" by blueye118

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Lucene-java Wiki" for change notification.

The following page has been changed by blueye118:
http://wiki.apache.org/lucene-java/LuceneFAQ

------------------------------------------------------------------------------
    * Try to search or update an index with the lockDir configured to be on an NFS (or Samba) mounted filesystem.
  
  Even though index searching is a read only operation, the !IndexSearcher must momentarily lock the index when it is opened in order to get the list of files in the index.  If locking is not configured properly it gets an incorrect list (because the list of files changes as the !IndexWriter adds docs or optimizes the index).  Remote filesystems (like NFS and Samba) rarely work, because they cannot make the transactional guarantees neccessary to ensure that all clients get consistent views of the directory.
+ 
+ ==== Will TopDocCollector#collect(int doc, float score) operate on documents? ====
+ Does TopDocCollector continue collect when hq is full?
+ IF NOT, does it mean that the collect operation DO NOT cover all the documents?
+ {{{
+ class TopDocCollector extends HitCollector{
+ // ...
+   private int numHits;//the maximum number of hits to collect.
+   PriorityQueue hq;
+   public TopDocCollector(int numHits) {
+     this(numHits, new HitQueue(numHits));
+   }
+ 
+   TopDocCollector(int numHits, PriorityQueue hq) {
+     this.numHits = numHits;
+     this.hq = hq;
+   }
+   
+   public void collect(int doc, float score) {
+ 	if (score > 0.0f) {
+ 		totalHits++;
+ 		if (hq.size() < numHits || score >= minScore) {        
+ 			hq.insert(new ScoreDoc(doc, score));        
+ 			minScore = ((ScoreDoc)hq.top()).score; // maintain minScore     
+ 		}   
+ 	} 
+  }
+ // ...
+ }
+ 
+ }}}
  
  === Indexing ===