FAQ
Are there any issues surrounding TermDocs.skipTo(). I have a index that works okay if I use TermDocs.next() to find next doc id, but using skipTo to go to the one after a point can miss sometimes.

e.g. Iterating using TermDocs.next() and TermDocs.doc() 1,50,10000,20000 but suing TermDocs.skipTo(51) returns false indicating that no doc id > 50 exists.

I will try and create a sample index to show this.

Many Thanks

Mike

Search Discussions

  • Michael Busch at Oct 29, 2007 at 4:08 pm

    Mike Streeton wrote:
    e.g. Iterating using TermDocs.next() and TermDocs.doc() 1,50,10000,20000 but suing TermDocs.skipTo(51) returns false indicating that no doc id > 50 exists.
    Hi Mike,

    I quickly tried to reproduce this (with the same docids), but for me
    skipTo() works fine, i. e. td.skipTo(51) returns true and td.doc()
    returns 10000 thereafter.
    I will try and create a sample index to show this.
    So yes, please provide a testcase showing the problem!

    Thanks,
    -Michael

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Mike Streeton at Nov 5, 2007 at 12:46 pm
    Can TermDocs be reused i.e. can you do.

    TermDocs docs = reader.termDocs();
    docs.seek(term1);
    int i = 0;
    while (docs.next()) {
    i++;
    }
    docs.seek(term2);
    int j = 0;
    while (docs.next()) {
    j++;
    }

    Reuse does seem to work but I get ArrayIndexOutOfBoundsExceptions from BitVector it I reuse the same one over a period of time.

    Many Thanks

    Mike

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Yonik Seeley at Nov 5, 2007 at 2:30 pm

    On 11/5/07, Mike Streeton wrote:
    Can TermDocs be reused i.e. can you do.

    TermDocs docs = reader.termDocs();
    docs.seek(term1);
    int i = 0;
    while (docs.next()) {
    i++;
    }
    docs.seek(term2);
    int j = 0;
    while (docs.next()) {
    j++;
    }

    Reuse does seem to work but I get ArrayIndexOutOfBoundsExceptions from BitVector it I reuse the same one over a period of time.
    That shouldn't happen... your reuse looks fine.
    TermDocs instances are not thread safe - I assume you are only reusing
    it from a single thread?
    Is it possible for you to create a test case that reproduces this?

    -Yonik

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedOct 29, '07 at 2:11p
activeNov 5, '07 at 2:30p
posts4
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase