You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Daniel Cortes <dc...@fib.upc.edu> on 2006/02/15 18:59:17 UTC

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/%3C20030630124930.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


Re: Iterating hits

Posted by Yonik Seeley <ys...@gmail.com>.
Try using a different reader to delete the documents.
Hits can re-execute a query, and if the searcher you are using is
sharing the reader you are deleting with, it's like changing a list
you are iterating over (fewer hits will be found the next time the
query is executed).

-Yonik

On 2/15/06, Daniel Cortes <dc...@fib.upc.edu> wrote:
> 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/%3C20030630124930.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