apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.6k stars 1.01k forks source link

Add DocIdSetIterator.range method [LUCENE-8378] #9425

Closed asfimport closed 6 years ago

asfimport commented 6 years ago

We already have DocIdSetIterator.all and DocIdSetIterator.empty but I'd like to also add a range method to match a specified range of docids.

E.g. this can be useful if you sort your index by a key, and then create a custom query to match documents by values for that key, or by range (#8765).


Migrated from LUCENE-8378 by Michael McCandless (@mikemccand), resolved Jul 05 2018 Attachments: LUCENE-8378.patch (versions: 2)

asfimport commented 6 years ago

Robert Muir (@rmuir) (migrated from JIRA)

Can we check that min >= 0 as well?

asfimport commented 6 years ago

Michael McCandless (@mikemccand) (migrated from JIRA)

Ahh yes I'll add that.

asfimport commented 6 years ago

Michael McCandless (@mikemccand) (migrated from JIRA)

New patch, also bounds checking minDoc.

asfimport commented 6 years ago

Yonik Seeley (@yonik) (migrated from JIRA)

I assume it's a bug that minDoc is always returned? edit: oops, sorry, I missed the "static" in the method signature. I thought this was providing a slice of another iterator for a minute.

asfimport commented 6 years ago

Adrien Grand (@jpountz) (migrated from JIRA)

+1

The if (doc == -1) specialization in nextDoc() doesn't seem to buy much compared to always returning advance(doc + 1)?

asfimport commented 6 years ago

Michael McCandless (@mikemccand) (migrated from JIRA)

The if (doc == -1) specialization in nextDoc() doesn't seem to buy much compared to always returning advance(doc + 1)?

Oh yes, that's silly; I'll remove it.

asfimport commented 6 years ago

ASF subversion and git services (migrated from JIRA)

Commit 4dc2008dc14b468ab1f1d37a0f138c0411ca17c2 in lucene-solr's branch refs/heads/master from Mike McCandless https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4dc2008

LUCENE-8378: add DocIdSetIterator.range method

asfimport commented 6 years ago

ASF subversion and git services (migrated from JIRA)

Commit 607e81757a45289ef8f0b9dbff4cab9f894014f5 in lucene-solr's branch refs/heads/branch_7x from Mike McCandless https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=607e817

LUCENE-8378: add DocIdSetIterator.range method

asfimport commented 6 years ago

Michael McCandless (@mikemccand) (migrated from JIRA)

Thanks all!