简体   繁体   中英

SOLR query, value of field 1 is same as field 2, OR field 1 is empty

Got a SOLR query question here, how do I construct my query to suit the following condition:

(value of field 1 is same as field 2) OR (field 1 is empty)

Cheers

James

  • value of field 1 is same as field 2

    As far as I know there is no good way to do this at query-time. So do it at index-time, ie when indexing, run the comparison and put the result in a field, then query that field.

  • field 1 is empty

     -field1:[* TO *] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM