0

I would like to exclude employees from employee collection with the hire date after 01/01/2020 and the status as active from the bonus collection. So I need to do a negative join with the employee collection and have 2 criteria. Here is my sample

join

q: bonus>0
fq: -{!join from = employeeid to = employeeid fromIndex = employee}(hiredate:["01/01/2020" to *] AND status:active)

I have tried the above query however it returns the following error

"org.apache.solr.search.SyntaxError: Cannot parse '(hiredate:["01/01/2020" to ]': Encountered \"\" at line 1, column 15.\nWas expecting one of:\n ...\n ...\n
...\n \"+\" ...\n \"-\" ...\n ...\n \"(\" ...\n \")\" ...\n \"
\" ...\n \"^\" ...\n ...\n
...\n ...\n ...\n ...\n ...\n \"[\" ...\n \"{\" ...\n ...\n \"filter(\" ...\n ...\n ",

Thanks, Gaurav

Simas Joneliunas
  • 2,890
  • 20
  • 28
  • 35
Gaurav
  • 1
  • You could index `bonus` into employee index as well so that you would just have to apply a simple fq on it. – EricLavault Jan 08 '20 at 06:38
  • The `hiredate` format you're using won't do what you're expecting it to as well. It seems you've indexed it as a string (a date would have to be formatted like `YYYY-MM-DDTHH:MM:SSZ`). When using `TO` (it should be capitialized) it'd give you any tokens that sort after `01/01/2020` - meaning anything that starts with `02` etc., regardless of year. – MatsLindh Jan 08 '20 at 08:08
  • To simplify the question, solr throws an error when trying to perform a negative join on multiple fields so for e.g -{!join from = employeeid to = employeeid fromIndex = employee}status:active works fine however -{!join from = employeeid to = employeeid fromIndex = employee}(Name:"XYZ" AND status:active) throws error. Same thing works properly for positive join when we remove - from the join. Please suggest – Gaurav Jan 08 '20 at 18:28

0 Answers0