Guy Mazouz
Guy Mazouz

Reputation: 437

Solr version field type

I'm looking for a field type that supports comparing versions, meaning I will be able to run lucene query with range of versions and find only the relevant versions:

eg. sdkVersion: [3.0.0.0.1 TO 3.1.1.0]

for example right now im forced to write something like this: sdkVersion:[2 TO 2.7.4.4] AND -sdkVersion:2.1?.* because 2.17 is actually smaller than 2.7

Thanks

Upvotes: 0

Views: 36

Answers (1)

Hector Correa
Hector Correa

Reputation: 26690

I don't think there is a field type that will do what you are asking for.

I would approach this by always storing the full zero-padded version in the sdkVersion field, for example:

store 02.07.04.04 rather than 2.7.4.4 and store 02.17.00.00 rather than 2.17

That way a query for sdkVersion:[02.00.00.00 TO 02.07.04.04] would do the proper filtering.

Upvotes: 2

Related Questions