Mailing List Archive

Range query with Lucene7.7.1 on old indexes.
Hi all,

Using: python 2.7.14, pylucene 4.10.0

Index:

xdate = long("20190101183030")
doc.add(LongField('xdate', xdate, Field.Store.YES)) # stored and not
analyzed

Query:

query = NumericRangeQuery.newLongRange("xdate", long("20190101000000"),
long("20190101115959"), True, True)

I am getting the results. It works fine.

Now i upgraded the lucene index 4.10.0 to lucene 7.7.1

Using : Python3.8.11, pylucene 7.7.1

I am searching on my old indexes, using the following queries

query = NumericDocValuesField.newSlowRangeQuery("xdate",
long("20190101000000"), long("20190101115959"))

No results.

query = LongPoint.newRangeQuery("xdate", long("20190101000000"),
long("20190101115959"))

No results.

How to get the results on my old indexes using date range query?

Can anyone help?

Thanks
Re: Range query with Lucene7.7.1 on old indexes. [ In reply to ]
Hi,
The old trie based range fields were deprecated in License 6 and removed in 7.

https://lucene.apache.org/core/6_6_0/core/org/apache/lucene/search/LegacyNumericRangeQuery.html

Upgrading the index does not help, because there's no easy way to convert trie fields to points and thats not done automatically. I wrote a hack to do this for a customer, but it requires a complete rewrite of index (read 5.x index with Lucene 6 and use addIndexes for merging into an empty index, while emulating points. The code is not open source and requires careful usage. Basically it enumerates the trie terms during merging and pushes them as flattened BKD tree. Lucene will rebuild the full tree while merging.

Uwe

Am 1. September 2021 17:20:24 UTC schrieb Antony Joseph <antony.dev.webmail@gmail.com>:
>Hi all,
>
>Using: python 2.7.14, pylucene 4.10.0
>
>Index:
>
>xdate = long("20190101183030")
>doc.add(LongField('xdate', xdate, Field.Store.YES)) # stored and not
>analyzed
>
>Query:
>
>query = NumericRangeQuery.newLongRange("xdate", long("20190101000000"),
>long("20190101115959"), True, True)
>
>I am getting the results. It works fine.
>
>Now i upgraded the lucene index 4.10.0 to lucene 7.7.1
>
>Using : Python3.8.11, pylucene 7.7.1
>
>I am searching on my old indexes, using the following queries
>
>query = NumericDocValuesField.newSlowRangeQuery("xdate",
>long("20190101000000"), long("20190101115959"))
>
>No results.
>
>query = LongPoint.newRangeQuery("xdate", long("20190101000000"),
>long("20190101115959"))
>
>No results.
>
>How to get the results on my old indexes using date range query?
>
>Can anyone help?
>
>Thanks

--
Uwe Schindler
Achterdiek 19, 28357 Bremen
https://www.thetaphi.de