I have a 404 page and a Global page, that i want to exclude from the search results i get, but i have yet to figure out a way to get it to work..
i have the below code.
var query = Umbraco.ContentQuery.Search(searchTerm, skipAmount, pageSize, out long resultCount);
var result = query != null ? query.Select(x => x.Content) : null;
result.Where(x=> !x.IsDocumentType(NotFound.ModelTypeAlias) && !x.IsDocumentType(Global.ModelTypeAlias))
but the where does not exclude it.
Is there some other way ?
I have a hard time finding anything about the ContentQuery.Search.
Exclude pages from contentquery.search
I have a 404 page and a Global page, that i want to exclude from the search results i get, but i have yet to figure out a way to get it to work.. i have the below code.
but the where does not exclude it. Is there some other way ? I have a hard time finding anything about the ContentQuery.Search.
Hi André
Do you need to assign the Where filter ?
eg
just calling .Where() on the set of results, won't filter the original set of results... if that makes sense?
regards
marc
im ofcourse saving the result of where in another variable...
But it noes not appear to filter it.
is working on a reply...