SolrSearchConfig: How do I prioritize a specific space

Hi.

Currently my SolrSearchConfig looks like:

#set ($__defaultSolrConfig = {
  'queryFields': {
    'DOCUMENT': 'property.XWiki.TagClass.tags^20.0
                 spaces^15.0
                 title^10.0 name^10.0
                 doccontent^2.0
                 objcontent^0.4 filename^0.4 attcontent^0.4 doccontentraw^0.4
                 author_display^0.08 creator_display^0.08
                 comment^0.016 attauthor_display^0.016',
    'ATTACHMENT': 'filename^5.0 attcontent attauthor_display^0.2',
    'OBJECT': 'objcontent',
    'OBJECT_PROPERTY': 'propertyvalue'
  },

How can I prioritize all children at “Glossar.WebHome”?

Regards, Simpel

1 Like

Hi,

You can add a boost query into the Solr suggestion configuration via the Administration section / Search / Search Suggest.
And customize one of the sources, for instance, “Page titles” with default Query

fq=type:DOCUMENT
qf=title^2 name

just add this line bq=space_exact:[spaceName] with specify your space.

1 Like

That’s nice. But I would prefer to prioritize it in main search.

The boot query parameter is currently not exposed in the main search configuration (SolrSearchConfig). Exposing it is not very complex. You need to:

Hope this helps,
Marius

1 Like

That works perfectly:
Main/SolrSearchConfig:

'boostQuery': {
    'DOCUMENT': 'space_prefix:Glossar^10'
  },

and
Main/SolrSearchMacros at #macro (getSearchResults) ~ line 580:

#set ($discard = $query.bindValue('bq', $solrConfig.boostQuery.get($type)))

Thank you.