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 Nuno Oliveira <no...@itclinical.com> on 2017/07/24 19:18:09 UTC
LongPoint.newRangeQuery results differ from
LegacyNumericRangeQuery.newLongRange
Hi, I hope someone can help me.
I have a project which uses Lucene and I have been upgrading it from
version 4.10.4 to 6.6.0, so I upgraded my indexes which were created in
4.10.0, using the terminal, to version 5.0.0 like the migration guide
tells.
Due to the upgrade I changed LegacyNumericRangeQuery.newLongRange, used
to query a date range, to LongPoint.newRangeQuery.
The problem is that with this LongPoint.newRangeQuery I get 0 hits from
my upgraded indexes but I get the correct number of hits from indexes
created in 6.6.0. and if I change back to
LegacyNumericRangeQuery.newLongRange I get hits in my upgraded indexes
but no hits in indexes created in 6.6.0.
Also I have the backwards-codecs for version 6.6.0. I guess it is some
kind of problem with the upgrade of the indexes but I'm a little lost,
so If someone has any hints I would be really grateful.
Thanks,
Nuno Oliveira
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: LongPoint.newRangeQuery results differ from
LegacyNumericRangeQuery.newLongRange
Posted by Nuno Oliveira <no...@itclinical.com>.
Thank you for your answer Chris.
What I did was to get all the Documents from the old indexes, and loop
the existingDocuments, then I replaced the "date" field by the same
values but created with LongPoints.
Something like this:
for (Document existingDocument : existingDocuments) {
Document doc = createDocument();
doc.add(createStringField("recordId", existingDocument.get("recordId"),
Field.Store.YES));
//Here I create a new LongPoint based on the "date" of the
//old documents represented by LongField
doc.add(new
LongPoint("date",Long.valueOf(existingDocument.get("date"))));
indexWriter.updateDocument(new
Term("recordId",existingDocument.get("recordId")), doc);
}
This way my queries are returning the number of hits I expected.
Do you think this is wrong in any way? I don't know if this can be
considered reindex, since I'm not using the original documents to index
but old indexes and if it can cause any problems.
Thanks,
Nuno Oliveira
On Seg, 2017-07-24 at 13:48 -0700, Chris Hostetter wrote:
> The Points data structures are completley different and distinct
> from the Term Index structures used by LegacyNumeric fields -- just having
> hte backwards codex (or using merges to convert indexes to the new index
> format) isn't enough -- you have to reindex.
>
>
>
> -Hoss
> http://www.lucidworks.com/
>
> ---------------------------------------------------------------------
> 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
Re: LongPoint.newRangeQuery results differ from
LegacyNumericRangeQuery.newLongRange
Posted by Chris Hostetter <ho...@fucit.org>.
The Points data structures are completley different and distinct
from the Term Index structures used by LegacyNumeric fields -- just having
hte backwards codex (or using merges to convert indexes to the new index
format) isn't enough -- you have to reindex.
-Hoss
http://www.lucidworks.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org