lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sharad Agarwal <sharad...@aol.com>
Subject IndexReader seems loading the full index
Date Tue, 16 May 2006 18:04:00 GMT
I am a newbie in lucene space. and trying to understand lucene search 
result caching; facing with a wierd issue.

After creating the IndexReader from a file system directory, I 
rename/remove the index directory; but still I am able to search the 
index and able to get the documents from Hits. This is making me beleive 
that there is some level of index loading in IndexReader itself. Does it 
load the full index or what all things it loads?

The code I am using is:

    reader = IndexReader.open("/data/index");
    System.out.println("Sleeping..."); 

    Thread.sleep(10000);  
//during the sleep time I just delete /data/index dir but still rest of 
the code works

    System.out.println("Sleeping after");
    indexSearcher = new IndexSearcher(reader);
   query = MultiFieldQueryParser.parse("yahoo", fields,  new 
PorterStemAnalyzer());
   filter = new QueryFilter(query);
   
    Hits hits = indexSearcher.search(query, filter);
    for(int i=0;i<hits.length();i++){
        System.out.println(i +":     "+ hits.doc(i));
    }

-sharad



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


Mime
View raw message