Wiki source code of SolrSearchConfig
Last modified by Bimit Administrator on 03.02.2022, 10:17
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{velocity output="false"}} | ||
2 | #set ($supportedLocales = $xwiki.availableLocales) | ||
3 | {{/velocity}} | ||
4 | |||
5 | {{velocity output="false"}} | ||
6 | #set ($__defaultSolrConfig = { | ||
7 | 'queryFields': { | ||
8 | 'DOCUMENT': 'title^10.0 name^10.0 | ||
9 | doccontent^2.0 | ||
10 | objcontent^0.4 filename^0.4 attcontent^0.4 doccontentraw^0.4 | ||
11 | author_display^0.08 creator_display^0.08 | ||
12 | comment^0.016 attauthor_display^0.016 spaces^0.016', | ||
13 | 'ATTACHMENT': 'filename^5.0 attcontent attauthor_display^0.2', | ||
14 | 'OBJECT': 'objcontent', | ||
15 | 'OBJECT_PROPERTY': 'propertyvalue' | ||
16 | }, | ||
17 | 'phraseFields': { | ||
18 | 'DOCUMENT': "#expandField('title' '^400.0') | ||
19 | #expandField('doccontent' '^80.0') | ||
20 | filename^90.0 #expandField('attcontent' '^70.0') | ||
21 | comment^50.0 | ||
22 | author_display^40.0 creator_display^40.0 attauthor_display^20.0", | ||
23 | 'ATTACHMENT': "filename^90.0 #expandField('attcontent' '^70.0') attauthor_display^40.0", | ||
24 | 'OBJECT': 'objcontent^10.0', | ||
25 | 'OBJECT_PROPERTY': 'propertyvalue^10.0', | ||
26 | '' : "#expandField('title' '^400.0') | ||
27 | #expandField('doccontent' '^80.0') | ||
28 | filename^90.0 #expandField('attcontent' '^70.0') | ||
29 | author_display^40.0 creator_display^40.0 | ||
30 | comment^50.0 attauthor_display^20.0 | ||
31 | objcontent^10.0 propertyvalue^10.0" | ||
32 | }, | ||
33 | 'bigramPhraseFields': { | ||
34 | 'DOCUMENT': "#expandField('title' '^200.0') | ||
35 | #expandField('doccontent' '^40.0') | ||
36 | filename^45.0 #expandField('attcontent' '^35.0') | ||
37 | comment^25.0 | ||
38 | author_display^20.0 creator_display^20.0 attauthor_display^10.0", | ||
39 | 'ATTACHMENT': "filename^45.0 #expandField('attcontent' '^35.0') attauthor_display^20.0", | ||
40 | 'OBJECT': 'objcontent^5.0', | ||
41 | 'OBJECT_PROPERTY': 'propertyvalue^5.0', | ||
42 | '' : "#expandField('title' '^200.0') | ||
43 | #expandField('doccontent' '^40.0') | ||
44 | filename^45.0 #expandField('attcontent' '^35.0') | ||
45 | author_display^20.0 creator_display^20.0 | ||
46 | comment^25.0 attauthor_display^10.0 | ||
47 | objcontent^5.0 propertyvalue^5.0" | ||
48 | }, | ||
49 | 'trigramPhraseFields': { | ||
50 | 'DOCUMENT': "#expandField('title' '^300.0') | ||
51 | #expandField('doccontent' '^60.0') | ||
52 | filename^67.5 #expandField('attcontent' '^52.5') | ||
53 | comment^37.5 | ||
54 | author_display^30.0 creator_display^30.0 attauthor_display^15.0", | ||
55 | 'ATTACHMENT': "filename^67.5 #expandField('attcontent' '^52.5') attauthor_display^30.0", | ||
56 | 'OBJECT': 'objcontent^7.5', | ||
57 | 'OBJECT_PROPERTY': 'propertyvalue^7.5', | ||
58 | '' : "#expandField('title' '^300.0') | ||
59 | #expandField('doccontent' '^60.0') | ||
60 | filename^67.5 #expandField('attcontent' '^52.5') | ||
61 | author_display^30.0 creator_display^30.0 | ||
62 | comment^37.5 attauthor_display^15.0 | ||
63 | objcontent^7.5 propertyvalue^7.5" | ||
64 | }, | ||
65 | 'phraseFieldSlop': '15', | ||
66 | 'bigramPhraseFieldSlop': '5', | ||
67 | 'trigramPhraseFieldSlop': '10', | ||
68 | 'tieBreaker': '0.1', | ||
69 | 'minShouldMatch': '2', | ||
70 | 'sortFields': { | ||
71 | 'DOCUMENT': { | ||
72 | 'score': 'desc', | ||
73 | 'title_sort': 'asc', | ||
74 | 'date': 'desc', | ||
75 | 'author_display_sort': 'asc' | ||
76 | }, | ||
77 | 'ATTACHMENT': { | ||
78 | 'score': 'desc', | ||
79 | 'filename_sort': 'asc', | ||
80 | 'attsize_sort': 'asc', | ||
81 | 'attdate_sort': 'desc', | ||
82 | 'attauthor_display_sort': 'asc' | ||
83 | } | ||
84 | }, | ||
85 | 'filterQuery': [], | ||
86 | 'facetFields': ['type', 'wiki', 'space_facet', 'locale', 'author', 'creator', 'date', | ||
87 | 'creationdate', 'class', 'mimetype', 'attauthor', 'attdate', 'attsize'], | ||
88 | 'facetQuery': { | ||
89 | 'type': 'DOCUMENT', | ||
90 | 'locale': ["$xcontext.locale", ''] | ||
91 | }, | ||
92 | 'facetEnabled': true, | ||
93 | 'facetDisplayers': { | ||
94 | 'type': 'Main.SolrTypeFacet', | ||
95 | 'wiki': 'Main.SolrWikiFacet', | ||
96 | 'space_facet': 'Main.SolrSpaceFacet', | ||
97 | 'locale': 'Main.SolrLocaleFacet', | ||
98 | 'author': 'Main.SolrUserFacet', | ||
99 | 'creator': 'Main.SolrUserFacet', | ||
100 | 'attauthor': 'Main.SolrUserFacet', | ||
101 | 'date': 'Main.SolrDateFacet', | ||
102 | 'creationdate': 'Main.SolrDateFacet', | ||
103 | 'attdate': 'Main.SolrDateFacet', | ||
104 | 'class': 'Main.SolrClassFacet', | ||
105 | 'attsize': 'Main.SolrFileSizeFacet', | ||
106 | 'mimetype': 'Main.SolrMediaTypeFacet' | ||
107 | }, | ||
108 | 'facetDisplayersByPropertyType': { | ||
109 | 'Date': 'Main.SolrDateFacet', | ||
110 | 'Users': 'Main.SolrUserFacet', | ||
111 | 'Groups': 'Main.SolrUserFacet' | ||
112 | }, | ||
113 | 'facetPaginationStep': 5, | ||
114 | 'facet': { | ||
115 | 'mediaType': { | ||
116 | 'categories': { | ||
117 | 'text': ['text/', 'application/xml', 'application/javascript', 'application/ecmascript', | ||
118 | 'application/json', 'application/x-sh', '+xml'], | ||
119 | 'image': ['image/'], | ||
120 | 'office': ['application/pdf', 'application/postscript', 'application/msword', 'application/vnd.ms-', | ||
121 | 'application/vnd.oasis.opendocument.', 'application/vnd.openxmlformats-officedocument.'], | ||
122 | 'archive': ['application/zip', 'application/x-gzip', 'application/x-bzip', 'application/x-tar', | ||
123 | 'application/x-gtar', 'application/vnd.xara', '-archive', '-compressed', '-package', '+zip'], | ||
124 | 'audio': ['audio/'], | ||
125 | 'video': ['video/'], | ||
126 | 'font': ['application/font-', 'application/x-font-'] | ||
127 | }, | ||
128 | 'subcategories': { | ||
129 | 'office': { | ||
130 | 'word': ['application/msword', 'application/vnd.ms-word.', 'application/vnd.oasis.opendocument.text', | ||
131 | 'application/vnd.openxmlformats-officedocument.word'], | ||
132 | 'presentation': ['application/vnd.ms-powerpoint', 'application/vnd.oasis.opendocument.presentation', | ||
133 | 'application/vnd.openxmlformats-officedocument.presentation'], | ||
134 | 'spreadsheet': ['application/vnd.ms-excel', 'application/vnd.oasis.opendocument.spreadsheet', | ||
135 | 'application/vnd.openxmlformats-officedocument.spreadsheet'] | ||
136 | } | ||
137 | } | ||
138 | }, | ||
139 | 'fileSize': { | ||
140 | 'intervals': [ | ||
141 | { | ||
142 | 'id': 'tiny', | ||
143 | 'end': 10240 | ||
144 | }, { | ||
145 | 'id': 'small', | ||
146 | 'start': 10240, | ||
147 | 'end': 512000 | ||
148 | }, { | ||
149 | 'id': 'medium', | ||
150 | 'start': 512000, | ||
151 | 'end': 5242880 | ||
152 | }, { | ||
153 | 'id': 'large', | ||
154 | 'start': 5242880 | ||
155 | } | ||
156 | ] | ||
157 | } | ||
158 | }, | ||
159 | 'wikisSearchableFromMainWiki': $wikisSearchableFromMainWiki, | ||
160 | 'highlightEnabled' : true | ||
161 | }) | ||
162 | |||
163 | #if (!$xcontext.isMainWiki() || !$xwiki.hasSubWikis()) | ||
164 | ## Subwikis search by default in their content only so it doesn't make sense to display the wiki facet. | ||
165 | ## It also doesn't make sense to display the wiki facet if there is a single wiki. | ||
166 | #set ($discard = $__defaultSolrConfig.facetFields.remove('wiki')) | ||
167 | #end | ||
168 | |||
169 | #if ($solrConfig) | ||
170 | ## Merge the provided configuration with the default configuration. | ||
171 | #set ($discard = $__defaultSolrConfig.putAll($solrConfig)) | ||
172 | #end | ||
173 | #set ($solrConfig = $__defaultSolrConfig) | ||
174 | |||
175 | #macro (expandField $fieldName $fieldBoost) | ||
176 | ${fieldName}__${fieldBoost} ## | ||
177 | #foreach ($locale in $supportedLocales) | ||
178 | ${fieldName}_${locale}${fieldBoost} ## | ||
179 | #end | ||
180 | #end | ||
181 | {{/velocity}} |