solrj - How to enable using a magic field with eDisMax in Solr 9.4? - Stack Overflow

admin2025-05-01  2

I use Solr 9.4 and I'm trying to run a query with defType=eDisMax and qf=title,category,description, and mm=2<-1 4<70%.

Earlier, I was searching for q=phool+jhaadu and getting documents returned. Now I want to search for both "phool jhaadu" and "grass broom" with an OR condition.

I tried to write a query like: q=_query_:"{!edismax mm='2<-1 4<70%'}phool jhaadu" OR _query_:"{!edismax mm='2<-1 4<70%'}grass broom"

But this returned 0 results, even though "q=phool+jhaadu" by itself was returning many results.

As per the documentation the magic field _query_ is disabled by default and needs to be enabled by mentioning it in the uf parameter.

To use the uf parameter, so far I've tried:

  • q=_query_:"{!edismax mm='2<-1 4<70%' uf=,query}phool jhaadu" OR _query_:"{!edismax mm='2<-1 4<70%' uf=*,_query_}grass broom"

  • q=_query_:"{!edismax mm='2<-1 4<70%' uf=query}phool jhaadu" OR _query_:"{!edismax mm='2<-1 4<70%' uf=_query_}grass broom"

  • q=_query_:"{!edismax mm='2<-1 4<70%'}phool jhaadu" OR _query_:"{!edismax mm='2<-1 4<70%'}grass broom"&uf=*,_query_

  • q=_query_:"{!edismax mm='2<-1 4<70%'}phool jhaadu" OR _query_:"{!edismax mm='2<-1 4<70%'}grass broom"&uf=_query_

None of these have worked. All of them returned zero results despite there being many documents containing both "phool jhaadu" and "grass broom" in the title. What mistake am I making here?

转载请注明原文地址:http://anycun.com/QandA/1746029294a91564.html