Question

I am using Solr for my website. The document has two fields: genre and topic. For example, if I want to search a novel about love, then the solr query would be tyepDef=dismax&qf=genre,topic&q=genre:novel AND topic:about love. However, this returns no results. If I use edismax, however, all documents which topic begins with "about" are returned. These are two different extremes, nothing or all. How can I configure my query so exactly documents that satisfy both genre:novel and topic:about love will be returned?

Was it helpful?

Solution

I suppose as the genre is fixed, you should not be querying on the genre field.
You should rather be filtering on the genre field.
e.g. fq=genre:novel, this will be much more faster instead of the normal search.

The topic is a content field and can then be search as a normal query q=topic:about or as you are already using dismax/edismax you can use q=about&qf=topic

OTHER TIPS

dismax does not support field queries like this: genre:novel. Instead, you configure it to search on certain fields:

q=novel about love&qf=genre,topic&defType=dismax

The extended dismax handler (edismax) supports specifying fields.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top