Compare two fields in a query


(Info Styfi) #1

I'm trying to compare two fields and ensure one is greater than other. Something like this:
"doc['key1'].value > doc['key2'].value"

But this isn't working as scripting is disabled with my provider. Is there any other alternative to this?


(Glen Smith) #2

There isn't another way to compare two values of the same document as part of your search, no.


(Adrien Grand) #3

One work-around might be to index the difference of these two fields, and store the result in another field that you can perform range queries against. However that would require reindexing.


(Info Styfi) #4

Why didn't I think of this... Thank you for pointing it out.:slight_smile:


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.