Can the free text search match all terms

Vote:
 

Can the free text search as detailed here

http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Find/8/DotNET-Client-API/Searching/Free-text-search/

be configured to match all the terms (minus stop words used) - as detailed in the improving precision part of theelastic search document here

http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/match-multi-word.html

For instance if I do a search for cottages in belfast it returns a tonne of results with just cottages that we don't want to see

Many Thanks

#88650
Jul 22, 2014 16:00
Vote:
 

I know that this a very old thread but I had a difficult time finding the answer to this same question. So I'm posting it here as this was the only thread I found while searching, hopefully when someone else finds this thread as I did, they'll get the answer.

Essentially we want to "AND" the search terms instead of the default "OR".

The way to do this is to use the "WithAndAsDefaultOperator()"-method after a method that returns an IQueriedSearch<T>, which For() does.

For example:

SearchClient.Search<AClass>()
.For("cottages belfast")
.WithAndAsDefaultOperator();

This will only return results that match both "cottages" and "belfast".

#148850
Edited, May 25, 2016 10:25
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.