Skip to content
Snippets Groups Projects
Commit 59f693aa authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-10080: FAQ Search no longer searches in the FAQ space only when using the SOLR search

* Simplify a bit the configuration.
parent fa954449
No related branches found
No related tags found
No related merge requests found
......@@ -53,10 +53,7 @@
{{velocity output="false"}}
#if ($solrConfig)
## Overwrite some configuration parameters.
## We don't use the Result Type facet because the result type is specified in the filter query below so we set the
## query and sort fields for all result types.
#set ($discard = $solrConfig.queryFields.put($NULL, 'title^3 property.FAQCode.FAQClass.answer'))
#set ($discard = $solrConfig.sortFields.put($NULL, $solrConfig.sortFields.DOCUMENT))
#set ($solrConfig.queryFields = 'title^3 property.FAQCode.FAQClass.answer')
#set ($solrConfig.filterQuery = [
'type:DOCUMENT',
"wiki:$xcontext.database",
......@@ -64,7 +61,6 @@
'class:FAQCode.FAQClass'
])
#set ($solrConfig.facetFields = ['creator', 'creationdate', 'author', 'date', 'mimetype', 'attauthor', 'attdate', 'attsize'])
#set ($solrConfig.facetQuery = {})
#end
{{/velocity}}
......
......@@ -623,7 +623,14 @@
#macro (setQueryFields $query)
## Specify which index fields are matched when a free text search is performed.
#if ($boost == '')
#set ($boost = $solrConfig.queryFields.get($type))
#if ($solrConfig.queryFields.substring(0, 0) == '')
## If the value of the 'queryFields' parameter is a string then it means that the same query fields are used for
## all result types.
#set ($boost = $solrConfig.queryFields)
#else
## There are different query fields for each result type.
#set ($boost = $solrConfig.queryFields.get($type))
#end
#end
#if ("$!boost" != '')
#set ($discard = $query.bindValue('qf', $boost))
......@@ -736,6 +743,14 @@
#set ($type = $request.getParameterValues('f_type'))
#if ($type && $type.size() == 1)
#set ($type = $type.get(0))
#else
## Extract the result type from the filter query, if specified.
#foreach ($item in $solrConfig.filterQuery)
#if ($item.startsWith('type:'))
#set ($type = $item.substring(5))
#break
#end
#end
#end
#end
......@@ -806,6 +821,8 @@
{{/velocity}}
{{velocity}}
## Preselect facet values only for the facets that are enabled.
#set ($discard = $solrConfig.facetQuery.keySet().retainAll($solrConfig.facetFields))
#if ($request.media == 'rss')
#outputRSSFeed()
#elseif ("$!request.r" == '1' || $solrConfig.facetQuery.isEmpty())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment