4

When using the ContentSearch API what is the difference in using Where vs Filter and can this have any influence on the results?

From the Sitecore documentation :

Filtering is similar to using Where to restrict the result list. When you use Filter, the scoring/ranking of the search hits is not influenced by the filters, and filters can be cached to optimize search performance.

and

To avoid influencing the ranking of the search results, use Filter when applying restrictions to search queries in the GetGlobalFilters pipeline.

From my understanding of these statements, I assume that a set of documents meeting the Filter criteria could be cached and from that document set different queries could then be run, which should be quicker than searching against the entire index. Is this all there is, or can Filter actually change the results that are shown?

8

Where => q

The q parameter is normally the main query for the request

Filter => fq

"fq" stands for Filter Query.This parameter can be used to specify a query that can be used to restrict the super set of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries since the queries specified with fq are cached independently from the main query. Caching means the same filter is used again for a later query (i.e. there's a cache hit).

CommonQueryParameters

So, use Filter Query over Query wherever it is possible!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.