lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vanlerberghe, Luc" <Luc.Vanlerber...@bvdep.com>
Subject RE: Iterating hits
Date Thu, 16 Feb 2006 09:40:41 GMT
My guess is you are using the same reader both for searching and
deleting.

The Hits class buffers the first 100 hits, and when you go beyond that,
it reruns the query to get more hits.
If you use the same reader, the searcher probably doesn't return the
same results the second time.

If different readers are used, the one for searching won't 'see' the
changes the other makes until it is closed and reopened...

Hope this helps,

Luc

-----Original Message-----
From: Daniel Cortes [mailto:dcortes@fib.upc.edu] 
Sent: woensdag 15 februari 2006 18:59
To: 'Lucene Users List'
Subject: Iterating hits

Hi lucene users I have a strange error and I don't know to do?
My logs say this:
java.lang.ArrayIndexOutOfBoundsException: 100 >= 100
        at java.util.Vector.elementAt(Vector.java:431)
        at org.apache.lucene.search.Hits.hitDoc(Hits.java:127)
        at org.apache.lucene.search.Hits.doc(Hits.java:89)

my code is this
                PrefixQuery p = new PrefixQuery(new 
Term("TOOL_REF_ID",getINITIAL(tool)));
                Hits h = sr.search(p);
                for (int i=0;i<h.length(); i++){
                    log.debug(h.doc(i).getField("TYPE") + " 
"+h.doc(i).getField("TOOL_REF_ID"));
                    reader.delete(h.id(i));
                }           

Why? How can I do to delete all the documents that the tool_ref_if 
begins with for example "AK"?


Searching about it I find this :
http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200306.mbox/%3C
20030630124930.1324.qmail@nagoya.betaversion.org%3E

thks for any reply.



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



---------------------------------------------------------------------
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