Last modified by Thomas Mortagne on 2017/03/24

<
From version < 51.1 >
edited by Marius Dumitru Florea
on 2014/02/25
To version < 52.1 >
edited by Marius Dumitru Florea
on 2014/02/26
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -99,38 +99,26 @@
99 99  
100 100  === Search UI Configuration ===
101 101  
102 -We extracted the configuration parameters from the Solr Search UI code in a separate wiki page, ##Main.SolrSearchConfig##. This simplifies the process of customizing the search UI and more importantly allows application developers to easily create a dedicated search page for their application data. As an example, we updated the FAQ application to use the new configuration parameters:
102 +Application developers can now easily create a dedicated search page for their application, tailored for the application data. You can take a look at the [[FAQ application>>extensions:Extension.FAQ Application]] for example:
103 103  
104 104  {{code language="none"}}
105 105  {{include reference="XWiki.SearchCode"/}}
106 106  
107 -{{velocity}}
108 -##
109 -## Customize the Solr Search UI.
110 -##
107 +{{velocity output="false"}}
111 111  #if ($searchEngine == 'solr')
112 - ## Create the configuration object.
113 - {{include reference="Main.SolrSearchConfig"/}}
109 + ## Customize the Solr Search UI for the FAQ application.
110 + #set ($solrConfig = {
111 + 'queryFields': 'title^3 property.FAQCode.FAQClass.answer',
112 + 'facetFields': ['creator', 'creationdate', 'author', 'date', 'mimetype', 'attauthor', 'attdate', 'attsize'],
113 + 'filterQuery': [
114 + 'type:DOCUMENT',
115 + "wiki:$xcontext.database",
116 + "space_exact:$doc.space",
117 + 'class:FAQCode.FAQClass'
118 + ]
119 + })
114 114  #end
115 115  {{/velocity}}
116 -{{velocity output="false"}}
117 -#if ($solrConfig)
118 - ## Overwrite some configuration parameters.
119 - ## We don't use the Result Type facet because the result type is specified in the filter query below so we set the
120 - ## query and sort fields for all result types.
121 - #set ($discard = $solrConfig.queryFields.put($NULL, 'title^3 property.FAQCode.FAQClass.answer'))
122 - #set ($discard = $solrConfig.sortFields.put($NULL, $solrConfig.sortFields.DOCUMENT))
123 - #set ($solrConfig.filterQuery = [
124 - 'type:DOCUMENT',
125 - "wiki:$xcontext.database",
126 - "space_exact:$doc.space",
127 - 'class:FAQCode.FAQClass'
128 - ])
129 - #set ($solrConfig.facetFields = ['creator', 'creationdate', 'author', 'date', 'mimetype', 'attauthor', 'attdate', 'attsize'])
130 - ## No preselected facets.
131 - #set ($solrConfig.facetQuery = {})
132 -#end
133 -{{/velocity}}
134 134  
135 135  {{velocity}}
136 136  {{include reference="$searchPage"/}}

Get Connected