I have several 10 books in same wiki (I do not want to launch wiki after restart), then I am going to add search widget to panel. I just want the search results just being restricted to specifc root tree.
What kind of search is that? For Solr search you can use the space_prefix
field, see https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/xwiki-platform-search-solr-server-core/src/main/resources/conf/managed-schema#L150-L156 .
Hey @mflorea, thanks for the help it works fine for a single specific root tree. Is it also possible to do this for more than one roots? Like e.g. I have the roots A1., A2. and A3. and I want to restrict the solr search to show only the descendant documents for A1. and A3. I’ve already tried to do it with filterQuery: ['space_prefix: "A1" AND "A3"']
but it does not work.
Is there any solution to do this?
I assume the documents cannot descend from both A1 and A3 at the same time so the boolean operator you’re looking for is actually OR, i.e. “look for documents that are either descendants of A1 or A3”. This translates to:
filterQuery: ['space_prefix:(A1 A3)']
provided A1 and A3 don’t contain whitespaces or symbols that have a special meaning in the Solr query syntax. But note that even this might not work because of the minShouldMatch
config (currently set to 2). See Loading... which duplicates Loading... . See also The DisMax Query Parser | Apache Solr Reference Guide 8.3 .