Is it possible to not index some specific pages in solr ? Or is it possible to exclude them from global search

Hello there

I think everything is in the title. Is it possible to create XWiki Pages and to explicitely choose programmatically to not index this page in solr. Also is the reverse operation available.

The idea is, we have some pages accessible to everyone “XWikiGuest” and “XWikiAllGroup”, but we want to provide to the creator of theses pages a checkbox to decide if theses pages should be return in the global search or not.

You can see that as the YouTube feature where a video is public but “unlisted” you have to know the direct url to access it.

We are using the embedded Solr so far, and I create the page programmaticaly through an XWiki API.

Maybe it’s not possible in that case we will found an other way.

Thanks.

So the answer is kind of yes and no.

Strictly from Solr indexing point of view there is no option to entirely skip a page. That being said, what you can do is indicate that a page is “hidden”: hidden pages are indexed, but they won’t appear in the search result by default unless the current user indicates otherwise in the profile preferences. See https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/PageEditing#HHidingPages for more details.

You can find the following example to programmatically set a page hidden: https://snippets.xwiki.org/xwiki/bin/view/Extension/Mark%20documents%20as%20hidden.

Thanks thomas for the fast answer.

It seems to be a nice solution. But I have a doubt, a regular user can see an Hidden page in the left menu ? I think he can’t if he didn’t enable the Display Hidden Documents option in his profil right ? In that case we can’t use this solution :frowning:

Also I guess a user with Display Hidden Documents will have theses documents returned in the search even if hidden ?

In my case my user have Display Hidden Documents and I indeed see hidden pages like WebPreferences or others in the global search.

Our use case is very specific, no problem if it’s not possible I will rethough the feature.

Yes hidden is not just for Solr search but for all kind of filtering and summary including the document tree by default.

Ok thanks :+1: I’m going to found an other way for this feature. I put it solved, I was just looking for informations.