Hi Mathijis,
If I understand correctly, you want to only show search results for a visitor group. If you are not a part of the group, you don't see the results, correct? If that is the case, you can use: .FilterForVisitor(). so, here is a snippet to see it in action:
ITypeSearch<ISearchContent> query = _client.UnifiedSearchFor(searchText); var TypeFilter = _client.BuildFilter<PageData>().FilterForVisitor(); query = query.Filter(TypeFilter); var results = query.Skip((page - 1) * pageSize).Take(pageSize).GetResult(); return results;
I hope this helps.
Thanks!
John
Thanks for the quick reply. However, this doesn't work, and that's exactly the problem.
I don't need to add a FilterForVisitor, because by default GetResult includes a FilterForPublicSearch which in its turn includes the FilterForVisitor. But nevertheless I did try to add a FilterForVisitor, and it didn't change the results.
Somehow FilterForVisitor will only filter out pages you don't have access to. I my case the user does have access to the page but his vistitorgroup membership prevents him from seeing a certain piece of content on this page. But searching for this specific piece of content does include the page in the search results.
Hi Mathijis,
So, that is an interesting problem. I spoke to a very skilled and knowledgeable colleague of mine and he recommended that, since Find doesn't index any context of a visitor, you shouldn't index the block in question. He said that as a general rule of thumb, you shouldn't index personlized areas.
Thanks!
John
If I have a piece of content (e.g. a html block) a user will not see when he is not part of a visitor group, I can still search for this content and get the page on which the content resides as a search result. Is there any to prevent this from happening? The situation I now have is that a user can search a specific search term, get a result, but he will never see the search term on the page in the search result, because he will not see the content (block) containing the search term.