lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KARTHIK SHIVAKUMAR <nskarthi...@gmail.com>
Subject Re: Reopening an index reader still giving me deleted records ?
Date Tue, 08 Nov 2011 14:59:27 GMT
Hi

>>BUT still find records that have been deleted and no longer exist in the
index

Lucene API 3.3.0  has something like

*
org.apache.lucene.index.IndexCommit

Has this been used after deletion of the records ....plz check

The indexex may still be there and may popup on new search....



with regards
karthik
*


*
*





On Mon, Nov 7, 2011 at 7:06 PM, Paul Taylor <paul_t100@fastmail.fm> wrote:

>
> I build indexes from scratch every three hours in a seperate process, then
> when they are built I replace the old indexes with these new ones in my
> search server.
> Then I tell the search to reload the indexes as follows:
>
> public void reloadIndex() throws CorruptIndexException, IOException {
>
>        if (indexSearcher != null) {
>            IndexReader oldReader = indexSearcher.getIndexReader()**;
>            IndexReader newReader = oldReader.reopen();
>            if (oldReader != newReader) {
>                Similarity similarity = indexSearcher.getSimilarity();
>                indexSearcher = new IndexSearcher(newReader);
>                indexSearcher.setSimilarity(**similarity);
>                this.setLastServerUpdatedDate(**);
>                oldReader.close();
>            }
>        }
>    }
>
>
> What I'm finding is that new searches are finding new records added BUT
> still find records that have been deleted and no longer exist in the index.
> This is in one query, thus must mean I'm getting NEW AND OLD results for my
> new index reader rather than still using the old one, so am I
> misunderstanding what reopen() does, or it not working correctly ?
>
> thanks Paul
>
> (This code is only other plaae where reader is accessed:
>
> public Results searchLucene(String query, int offset, int limit) throws
> IOException, ParseException {
>
>        IndexSearcher searcher=null;
>        try {
>            searcher = getIndexSearcher();
>            searcher.getIndexReader().**incRef();
>            TopDocs topdocs = searcher.search(parseQuery(**query), offset
> + limit);
>            searchCount.incrementAndGet();
>            return processResults(searcher, topdocs, offset);
>        }
>        finally {
>            searcher.getIndexReader().**decRef();
>        }
>    }
> )
>
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.**apache.org<java-user-unsubscribe@lucene.apache.org>
> For additional commands, e-mail: java-user-help@lucene.apache.**org<java-user-help@lucene.apache.org>
>
>


-- 
*N.S.KARTHIK
R.M.S.COLONY
BEHIND BANK OF INDIA
R.M.V 2ND STAGE
BANGALORE
560094*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message