Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Is there a difference between QueryStringQuery.DefaultOperator and the WithAndAsDefaultOperator() ?

$
0
0

I have used QueryStringQuery.DefaultOperator to change the default operator of the query. My intention is to make the search operator 'AND' instead of 'OR'.

IClient client = SearchClient.Instance;
client.Search<SearchType>().For(Query, q=> {
                    q.DefaultOperator = BooleanOperator.And;
                }).Take(1000).GetResult();

And also I have got to know that the WithAndAsDefaultOperator() does the same thing as above ('AND' search instead of 'OR').

IClient client = SearchClient.Instance;
client.Search<SearchType>().For(Query).WithAndAsDefaultOperator().Take(1000).GetResult();

But when I actually see the results, they are different in order. Did I miss something or are these two things are not intended to do the same task?

Note: I did not find the WithAndAsDefaultOperator() in the Episerver Find Documentration. It's better if anyone could share the link of that just to refer.

Thanks.


Viewing all articles
Browse latest Browse all 9076

Trending Articles