Try our conversational search powered by Generative AI!

Komplementet till Match



I have a Block that makes the following search:

ITypeSearch query = SearchClient.Instance.UnifiedSearchFor("Glass");

EPiServer.Find.UnifiedSearch.UnifiedSearchResults Result = query.Take(5).GetResult();

And the Result contains of 5 matching Pages.

The problem is that the Block-search also containing the page the block is connected to, which I don't want.

I would like to use some kind of filter removing the page in the Result the block is connected to.

This query just makes the opposite, leaving the page the block is connected to

EPiServer.Find.UnifiedSearch.UnifiedSearchResults Result = query.Filter(x => x.SearchHitUrl.Match("")).Take(5).GetResult();

I would like something like, guery.Filter(x => SearchHitUrl.ComplementaryMatch("")).Take(5).GetResult();

/ Lennie

May 12, 2017 10:34

Do you mean negative filters?

From the documentation: "Like all filters it can be negated using an exclamation mark (!). In other words, to instead find all blog posts that does not have a title we could use the following code."


var searchQuery = client.Search<BlogPost>()
    .Filter(x => !x.Title.Exists());
May 12, 2017 11:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.