On 10/22/2015 10:37 AM, vitaly bulgakov wrote: > But it returns no results when the query has a term which is not in a > document. > Say searching for "building constructor" I get a result, but > searching for "good building constructor" returns no results because there > are no documents containing all three terms. > > What should I do to be able to search ignoring non-existing terms?
There are two reasons for this to fail. One reason is that your query is expecting all three terms to be in the index -- using AND for the default operator. This might be done with the q.op parameter if you're using the standard query parser, or the mm parameter (set to 100%) if you're using dismax/edismax. Older versions of Solr will let you configure the default operator in schema.xml, but this is discouraged, and I don't think it works in Solr 5.x. The default operator defaults to OR, but many people will set that to AND. The other possible reason is that you are passing the query text with the quotes, making it a phrase query, which means that the terms must all be present in the index, must be next to each other, and must be in that precise order. If this is the problem, try using q=(good building constructor) instead of q="good building constructor". Thanks, Shawn