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("http://url.to.block.page.com")).Take(5).GetResult();
I would like something like, guery.Filter(x => SearchHitUrl.ComplementaryMatch("http://url.to.block.page.com")).Take(5).GetResult();/ Lennie
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());