Manos
Manos

Reputation: 151

Query SOLR search using id and match documents using different fields

In order to describe the problem I will give an example. Let's say we have two documents in SOLR,

{id:"0001", "make":"Ford Focus Diesel"}

{id:"0002", "make":"Ford Focus ST"}

If the client searches for "Ford Focus ST" I want SOLR to return both documents. In other words I want Diesel and ST not to be considered. It would also nice if the client searches q=id:0001 and then sorl matches the documents using the title and excluding the words ST or diesel and therefore return both documents.

Any ideas how to customize SOLR to perform like that? Should I implement my own RequestHandler or using a handler that is available? I am now looking at the MoreLikeThisHandler

Upvotes: 0

Views: 262

Answers (1)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

If you are indexing make as text (not as strings) then what you are asking for should be happening automatically. In fact a record with any of the keywords will match.

If you are trying to match all keywords provided, you could switch to eDisMax query parser and use mm parameter to control the percentage of match required.

Upvotes: 2

Related Questions