How to compare two columns using Solr?

2019-08-13 23:55发布

问题:

Compare two columns in solr if two fields are equal display true or else false.

CASE WHEN o_is_follow = o_follow_id THEN 'TRUE' ELSE 'FALSE'.

回答1:

As per as I know comparing one field to another within a document is not supported in either Solr.

I think it can be achieved by one option of creating another field while indexing only.

You can have another field (boolean). Make this field as boolean type and can be used while searching. Create a o_is_follow_present field and set it to true for documents matching it while indexing.

Use the same field as one of your filter criteria..