Sathish Kumar
Sathish Kumar

Reputation: 87

Alphanumeric range query

Is there an effective way to handle alphanumeric ranges in lucene? Example ranges,

I have two approaches:

  1. Expand each range and index all possible values. I guess the unique values won't be huge.
  2. Index on low and high values. Then use range query. Not sure, how effective is range query on alphanumeric ranges

Need expert advice on this, please.

Upvotes: 0

Views: 261

Answers (1)

mindas
mindas

Reputation: 26703

I hope you agree that your defined rules are very customary and not really suitable for a generic framework, such as Lucene. For example, why would range [1..1] include letters but [1..10] wouldn't?

I don't know if it is possible with your data set, but if you could come up with rules, converting each element (including element having letters) into a unique number using some arbitrary formula, you could use this formula both when indexing and querying. This would even allow range matching.

Upvotes: 1

Related Questions