Doing Range/NUmber queries

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Doing Range/NUmber queries

lukes
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Doing Range/NUmber queries

lukes
Update(Found the answer for point 2).
Reply | Threaded
Open this post in threaded view
|

Re: Doing Range/NUmber queries

Michael McCandless-2
For 1), you need to copy it yourself, i.e. add another Field to the Lucene
Document you are about to index, with the same (string, numeric, etc.)
value from the first field.

For 2), it's best to use points (IntPoint, etc.) for range filtering.

For 3), to search a boolean value, just map your boolean to a token, e.g.
"true" and "false".

Mike McCandless

http://blog.mikemccandless.com

On Mon, Aug 8, 2016 at 1:37 AM, lukes <[hidden email]> wrote:

> *Update(Found the answer for point 2).*
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/Doing-Range-NUmber-queries-tp4290722p4290725.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Doing Range/NUmber queries

lukes
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Doing Range/NUmber queries

Michael McCandless-2
No, you must replace the entire document: the old one is removed, and the
new one is indexed in its place.

The one exception to this is update-able document value (e.g. see
IW.updateNumericDocValue).

Mike McCandless

http://blog.mikemccandless.com

On Tue, Aug 9, 2016 at 2:49 PM, lukes <[hidden email]> wrote:

> Thanks Michael,
>
>  Is there a way to partially update the document ? I know there's a API
> updateDocument on IndexWriter, but that seems to create a new document with
> just a field i am specifying. What i want is delete some fields from
> existing(indexed) document, and then add some new fields(could or not be
> same). Alternatively i tried to search for the document, and then calling
> removeFields and finally updateDocument, but now any search after the above
> process is not able for find that document(I created the new IndexReader).
> Am i missing anything ?
>
> Regards.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/Doing-Range-NUmber-queries-tp4290722p4291023.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Doing Range/NUmber queries

lukes
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

RE: Doing Range/NUmber queries

Uwe Schindler
Hi,

Since Lucene 6, Filters as a separate class are gone (deprecated in Lucene 5). Every query can now be used as a filter. There are 2 possibilities:

- To apply as a filter next to other scoring queries, use a BooleanQuery with filter clauses (BooleanClause.Occur.FILTER) next to the standard scoring clauses (MUST or SHOULD). The FILTER clauses are standard queries.
- To execute a single query without scoring (constant score of 1), use ConstantScoreQuery

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [hidden email]

> -----Original Message-----
> From: lukes [mailto:[hidden email]]
> Sent: Wednesday, August 10, 2016 1:44 AM
> To: [hidden email]
> Subject: Re: Doing Range/NUmber queries
>
> Hi Michael,
>
>   Do you know, if Filtered Queries are supported in Lucene ? I tried to
> find, but couldn't find anything relevant. So i have some queries which i
> want to apply as filter, don't want to contribute in the scoring.Would
> filter queries speed up the query process ? Can i combine filter and queries
> together ? Also during indexing do i need to mention anything special for
> fields that can be used in filters ?
>
> Regards.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Doing-
> Range-NUmber-queries-tp4290722p4291058.html
> Sent from the Lucene - General mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

RE: Doing Range/NUmber queries

lukes
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

RE: Doing Range/NUmber queries

Uwe Schindler
Hi,

I don't understand your question. Filter queries no longer exit since Lucene 6! If you want to filter, use any query and pass it as BooleanClause.Occur.FILTER to aBooleanQuery. Done.

Those FILTER clauses may (depending on the query type) perform better than MUST clauses, because no score is calculated.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [hidden email]

> -----Original Message-----
> From: lukes [mailto:[hidden email]]
> Sent: Saturday, August 13, 2016 11:04 PM
> To: [hidden email]
> Subject: RE: Doing Range/NUmber queries
>
> Thanks Uwe,
>
>   Quick follow up questions, would Filter query perform any better ? I hope
> performance would still be same, but just out of curosity.
>
> Regards.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Doing-
> Range-NUmber-queries-tp4290722p4291666.html
> Sent from the Lucene - General mailing list archive at Nabble.com.