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 Cristian Lorenzetto <cr...@gmail.com> on 2017/12/31 12:17:27 UTC

typed IntPoint.RangeQuery & LongPoint.rangeQuery

Hi i have doubt.
Considering i want search a document field 'a' in a range. The same problem
is also if i search for a exact point.
I know that it is possible a document containing either a property 'a' with
type Integer either with type Long. For example document 1 contains {a:5}
where 5 is int, document 2 is {a:100} is long.

How to search all documents in range [4,101].

The right query is
 IntPoint.rangequery(a,4,101) or LongPoint.rangequery(a,4,101) ?

The question is more generic: every type has its algorithm for matching so
i thought theoretically
it is possible in the while i search a string 'hi' i find also a document
 with a property with type not string because it contains the same ByteRef?

Re: typed IntPoint.RangeQuery & LongPoint.rangeQuery

Posted by Michael McCandless <lu...@mikemccandless.com>.
Lucene doesn't (shouldn't?) let you add 'a' at first as an IntPoint and
then later as a LongPoint -- they must always be consistent.

So however you indexed it, you must use the corresponding class to
construct the query.

String 'hi' can only be found if you had indexed a token 'hi' in that field
-- the terms + postings are separate from the dimensional points (and from
doc values) so they cannot "cross talk".

Mike McCandless

http://blog.mikemccandless.com

On Sun, Dec 31, 2017 at 7:17 AM, Cristian Lorenzetto <
cristian.lorenzetto@gmail.com> wrote:

> Hi i have doubt.
> Considering i want search a document field 'a' in a range. The same problem
> is also if i search for a exact point.
> I know that it is possible a document containing either a property 'a' with
> type Integer either with type Long. For example document 1 contains {a:5}
> where 5 is int, document 2 is {a:100} is long.
>
> How to search all documents in range [4,101].
>
> The right query is
>  IntPoint.rangequery(a,4,101) or LongPoint.rangequery(a,4,101) ?
>
> The question is more generic: every type has its algorithm for matching so
> i thought theoretically
> it is possible in the while i search a string 'hi' i find also a document
>  with a property with type not string because it contains the same ByteRef?
>