1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function prefs_unified_list()
9{
10	return [
11		'unified_engine' => [
12			'name' => tra('Unified search engine'),
13			'description' => tra('Search engine used to index the content of this Tiki site. Some engines are more suitable for larger sites, but require additional software on the server.'),
14			'type' => 'list',
15			'options' => [
16				'lucene' => tra('Lucene (PHP implementation) - Deprecated'),
17				'mysql' => tra('MySQL full-text search'),
18				'elastic' => tra('Elasticsearch'),
19			],
20			'default' => 'mysql',
21		],
22		'unified_lucene_location' => [
23			'name' => tra('Lucene index location'),
24			'description' => tra('Path to the location of the Lucene search index. The index must be on a local filesystem with enough space to contain the volume of the database.'),
25			'type' => 'text',
26			'size' => 35,
27			'default' => 'temp/unified-index',
28		],
29		'unified_lucene_highlight' => [
30			'name' => tra('Highlight results snippets'),
31			'description' => tra('Highlight the result snippet based on the search query to improve user experience.'),
32			'type' => 'flag',
33			'default' => 'n',
34			'warning' => tra('May impact performance'),
35			'tags' => ['basic'],
36		],
37		'unified_lucene_max_result' => [
38			'name' => tra('Lucene maximum results'),
39			'description' => tra('Maximum number of results to produce. Results beyond these will need a more refined query to be reached.'),
40			'type' => 'text',
41			'filter' => 'int',
42			'units' => tra('results'),
43			'default' => 200,
44			'size' => 6,
45		],
46		'unified_lucene_max_resultset_limit' => [
47			'name' => tra('Lucene maximum result-set limit'),
48			'hint' => tra('Maximum size of result set to consider.'),
49			'description' => tra('This is used when calculating result scores and sort order which can lead to "out of memory" errors on large data sets. The default of 1000 is safe with the PHP memory_limit set to 128M'),
50			'type' => 'text',
51			'filter' => 'int',
52			'shorthint' => tr('0 for unlimited'),
53			'units' => tra('result sets'),
54			'default' => 1000,
55			'size' => 6,
56		],
57		'unified_lucene_terms_limit' => [
58			'name' => tra('Lucene terms per query limit'),
59			'description' => tra('Maximum number of terms to be generated. This value may need to be increased in the case of "Terms per query limit is reached" espescially with wildcard, range and fuzzy searches.'),
60			'type' => 'text',
61			'filter' => 'int',
62			'units' => tra('terms'),
63			'default' => 1024,
64			'size' => 6,
65		],
66		'unified_lucene_max_buffered_docs' => [
67			'name' => tra('Lucene maximum number of buffered documents'),
68			'description' => tra('Number of documents required before the buffered in-memory documents are written into a new segment.'),
69			'hint' => tra(''),
70			'type' => 'text',
71			'filter' => 'int',
72			'units' => tra('documents'),
73			'default' => 10,
74			'size' => 6,
75		],
76		'unified_lucene_max_merge_docs' => [
77			'name' => tra('Lucene maximum number of merge documents'),
78			'description' => tra('Largest number of documents merged by addDocument(). Small values (for example, less than 10,000) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches.'),
79			'hint' => tra('Small values (for example, less than 10,000) are best for interactive indexing. Use 0 for the Lucene default, which is practically infinite.'),
80			'type' => 'text',
81			'filter' => 'int',
82			'units' => tra('merge documents'),
83			'default' => 0,
84			'size' => 8,
85		],
86		'unified_lucene_default_operator' => [
87			'name' => tra('Default Boolean Operator'),
88			'description' => tra('Use OR or AND as the default search operator.'),
89			'type' => 'list',
90			'filter' => 'int',
91			'default' => 1,
92			'options' => [
93				1 => tra('AND'),
94				0 => tra('OR'),
95			],
96		],
97		'unified_lucene_merge_factor' => [
98			'name' => tra('Lucene merge factor'),
99			'description' => tra('How often segment indices are merged by addDocument(). With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster.'),
100			'hint' => tra('Large values (greater than 10) are best for batch index creation, and smaller values (less than 10) for indices that are interactively maintained.'),
101			'type' => 'text',
102			'filter' => 'int',
103			'default' => 10,
104			'size' => 6,
105		],
106		'unified_incremental_update' => [
107			'name' => tra('Incremental Index Update'),
108			'description' => tra('Update the index incrementally as the site content is modified.'),
109			'type' => 'flag',
110			'warning' => tra('This may lead to lower performance and accuracy than processing the index on a periodic basis.'),
111			'default' => 'y',
112		],
113		'unified_field_weight' => [
114			'name' => tra('Field weights'),
115			'description' => tra('Allow the field weights to be set that apply when ranking pages in the search results. The weight is applied only when the field is in the query. To nullify the value of a field, use an insignificant amount, but not 0, which may lead to unexpected behaviors such as stripping of results.') .
116				'<br>(' . tr('Add these fields to the "Default content fields" preference below for it to have an effect in a global "content" search') . ')',
117			'hint' => tra('One field per line, field_name__:__5.3'),
118			'type' => 'textarea',
119			'size' => 5,
120			'filter' => 'text',
121			'default' => "title:2.5\nallowed_groups:0.0001\ncategories:0.0001\ndeep_categories:0.0001",
122		],
123		'unified_numeric_field_scroll' => [
124			'name' => tra('Numeric field data modification via scroll'),
125			'description' => tra('Allow the numeric field data to be changed on movement of mousepad or mouse scroll'),
126			'type' => 'list',
127			'options' => [
128				'none' => tra('Disabled'),
129				'browser' => tra('Use default behavior of the browser (browsers have different behaviors)'),
130			],
131			'default' => 'none',
132		],
133		'unified_default_content' => [
134			'name' => tra('Default content fields'),
135			'description' => tra('All of the content is aggregated in the contents field. For custom weighting to apply, the fields must be included in the query. This option allows other fields to be included in the default content search.'),
136			'type' => 'text',
137			'separator' => ',',
138			'filter' => 'word',
139			'default' => ['contents', 'title'],
140			'size' => 80,
141		],
142		'unified_tokenize_version_numbers' => [
143			'name' => tra('Tokenize version numbers'),
144			'description' => tra('Tokenize version number strings so that major versions are found when sub-versions are mentioned. For example, searching for 2.7 would return documents containing 2.7.4, but not 1.2.7.'),
145			'type' => 'flag',
146			'default' => 'n',
147		],
148		'unified_user_cache' => [
149			'name' => tra('Cache per user and query for Tiki built-in search'),
150			'type' => 'text',
151			'size' => '4',
152			'filter' => 'digits',
153			'description' => tra('Time in minutes a user has a same query cached applied to Tiki built-in search interface only.'),
154			'units' => tra('minutes'),
155			'default' => '0',
156			'tags' => ['advanced'],
157		],
158		'unified_forum_deepindexing' => [
159			'name' => tra('Index forum replies together with initial post'),
160			'description' => tra('Forum replies will be indexed together with the initial post as a single document instead of being indexed separately.'),
161			'type' => 'flag',
162			'default' => 'y',
163		],
164		'unified_relation_object_indexing' => [
165			'name' => tra('Relation types to index within object.'),
166			'description' => tra('Comma-separated relation types for which objects should be indexed in their related objects.'),
167			'type' => 'textarea',
168			'hint' => tr('Elasticsearch needed'),
169			'default' => '',
170			'dependencies' => [
171				'unified_elastic_index_current',
172			],
173		],
174		'unified_cached_formatters' => [
175			'name' => tra('Cache individual search formatters'),
176			'description' => tra('List of search formatters whose output will be cached. This is separate to the result-specific formatted results cache.'),
177			'type' => 'text',
178			'separator' => ',',
179			'default' => [],
180			'tags' => ['advanced'],
181		],
182		'unified_trackerfield_keys' => [
183			'name' => tra('Format to use for tracker field keys'),
184			'description' => tra('Choose between field IDs and permanent names for the tracker indexing'),
185			'type' => 'list',
186			'default' => 'permName',
187			'options' => [
188				'permName' => tr('Permanent name'),
189				'fieldId' => tr('Field ID (backward compatibility mode with Tiki 7 and 8)'),
190			],
191		],
192		'unified_trackeritem_category_names' => [
193			'name' => tra('Index Tracker Category names'),
194			'description' => tra('Index the names and paths of category field values'),
195			'hint' => tra('Requires reindexing'),
196			'type' => 'flag',
197			'default' => 'n',
198			'dependencies' => [
199				'feature_trackers',
200				'feature_categories',
201				'feature_search',
202			],
203		],
204		'unified_cache_formatted_result' => [
205			'name' => tra('Cache result-specific formatted results'),
206			'description' => tr('Formatted search results such as the ones used in the List plugin will be cached to prevent process-intensive reformatting on each page load. The cache is result-specific.'),
207			'warning' => tr('Every different result will generate a separate cache. This could quickly build up a large cache directory. It is recommended to clear Tiki caches often (e.g. once per week) via an automated job if you use this feature.'),
208			'type' => 'flag',
209			'default' => 'n',
210			'tags' => ['advanced'],
211		],
212		'unified_excluded_categories' => [
213			'name' => tra('Excluded categories'),
214			'description' => tra('List of category IDs to exclude from the search index'),
215			'type' => 'text',
216			'separator' => ',',
217			'default' => [],
218			'profile_reference' => 'category',
219		],
220		'unified_excluded_plugins' => [
221			'name' => tra('Excluded plugins'),
222			'description' => tra('List of plugin names to exclude while indexing'),
223			'type' => 'text',
224			'filter' => 'word',
225			'separator' => ',',
226			'default' => [],
227		],
228		'unified_exclude_all_plugins' => [
229			'name' => tra('Exclude all plugins'),
230			'description' => tra('Indexing will exclude all plugins.'),
231			'type' => 'flag',
232			'default' => 'y',
233		],
234		'unified_included_plugins' => [
235			'name' => tra('Except included plugins'),
236			'description' => tra('List of plugin names that are required to be included while indexing, when excluding all.') . ' ' . tra('Example: fancytable,list,trackerlist,trackerfilter'),
237			'type' => 'text',
238			'filter' => 'word',
239			'separator' => ',',
240			'dependencies' => [
241				'unified_exclude_all_plugins',
242			],
243			'default' => [],
244		],
245		'unified_exclude_nonsearchable_fields' => [
246			'name' => tra('Don\'t index non searchable fields'),
247			'description' => tra('Indexing will skip adding all tracker fields that are not marked as "searchable". This will free index space but also make it impossible to use those fields in search index queries.'),
248			'type' => 'flag',
249			'default' => 'n',
250		],
251		'unified_elastic_url' => [
252			'name' => tra('Elasticsearch URL'),
253			'description' => tra('URL of any node in the cluster'),
254			'type' => 'text',
255			'filter' => 'url',
256			'default' => 'http://localhost:9200',
257			'size' => 40,
258		],
259		'unified_elastic_index_prefix' => [
260			'name' => tra('Elasticsearch index prefix'),
261			'description' => tra('The prefix that is used for all indexes for this installation in Elasticsearch'),
262			'type' => 'text',
263			'filter' => 'word',
264			'default' => 'tiki_',
265			'size' => 10,
266		],
267		'unified_elastic_index_current' => [
268			'name' => tra('Elasticsearch current index'),
269			'description' => tra('A new index is created upon rebuilding, and the old one is then destroyed. This setting enables seeing the currently active index.'),
270			'hint' => tra('Do not change this value unless you know what you are doing.'),
271			'type' => 'text',
272			'filter' => 'word',
273			'size' => '20',
274			'default' => '',
275		],
276		'unified_elastic_camel_case' => [
277			'name' => tr('Tokenize CamelCase words'),
278			'description' => tr('Consider the components of camel-case words as separate tokens, allowing them to be searched individually.'),
279			'warning' => tr('Conflicts with Tokenize Version Numbers.'),
280			'type' => 'flag',
281			'default' => 'n',
282		],
283		'unified_elastic_field_limit' => [
284			'name' => tra('Elasticsearch field limit per index'),
285			'units' => tra('fields'),
286			'type' => 'text',
287			'size' => '5',
288			'filter' => 'digits',
289			'description' => tra('The maximum number of fields per search index in Elasticsearch version 5.x and above'),
290			'default' => '1000',
291		],
292		'unified_elastic_mysql_search_fallback' => [
293			'name' => tra('Use MySQL Full-Text Search (fallback)'),
294			'type' => 'flag',
295			'description' => tra('In case of Elasticsearch is active and unavailable, use MySQL Full-Text Search as fallback'),
296			'default' => 'n',
297		],
298		'unified_mysql_index_current' => [
299			'name' => tra('MySQL full-text search current index'),
300			'description' => tra('A new index is created upon rebuilding, and the old one is then destroyed. This setting enables seeing the currently active index.'),
301			'hint' => tra('Do not change this value unless you know what you are doing.'),
302			'type' => 'text',
303			'filter' => 'word',
304			'size' => '20',
305			'default' => '',
306		],
307		'unified_mysql_index_rebuilding' => [
308			'name' => tra('The current MySQL index name that is being rebuild (Internal)'),
309			'description' => tra('This value helps to determine if there is a rebuild in progress, for incremental search.'),
310			'type' => 'text',
311			'filter' => 'word',
312			'size' => '20',
313			'default' => '',
314		],
315		'unified_mysql_short_field_names' => [
316			'name' => tra('MySQL use short field names'),
317			'description' => tra('Due to frm file constraints, number of search fields that one index can hold is usually limited to about 1500. This can be exceeded if you have numerous tracker fields. Enabling this option will try to shorten the field names internally that should allow you to use 300-500 more fields. Switching this option requires full index rebuild.'),
318			'type' => 'flag',
319			'default' => 'n',
320		],
321		'unified_identifier_fields' => [
322			'name' => tr('Unified index identifier fields (Internal)'),
323			'description' => tr('Used to store the fields to be considered as identifiers. This is overwritten after each index rebuilding.'),
324			'type' => 'text',
325			'hint' => tra('Do not change this value unless you know what you are doing.'),
326			'separator' => ',',
327			'default' => [],
328			'filter' => 'word',
329		],
330		'unified_add_to_categ_search' => [
331			'name' => tra('Use unified search in category admin'),
332			'description' => tra('Use unified search to find objects to add to categories. This limits the types of objects available to those included in the unified index.'),
333			'type' => 'flag',
334			'default' => 'n',
335			'dependencies' => [
336				'feature_search',
337			],
338		],
339		'unified_stopwords' => [
340			'name' => tr('Stop Word List'),
341			'description' => tr('Words excluded from the search index, because they can be too frequent and produce unwanted results.'),
342			'type' => 'text',
343			'default' => ["a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "not", "of", "on", "or", "s", "such", "t", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"],
344			'separator' => ',',
345			'hint' => tr('MySQL full-text search has its own list of stop words configured in the server.'),
346		],
347		'unified_trim_sorted_search' => [
348			'name' => tra('Automatically trim Elasticsearch results on date-sorted query'),
349			'description' => tra('Automatically trim Elasticsearch results in unified search if the query is sorted by modification or creation date.'),
350			'type' => 'flag',
351			'default' => 'n',
352			'dependencies' => [
353				'feature_search',
354			],
355		],
356		'unified_highlight_results' => [
357			'name' => tra('Highlight results pages'),
358			'description' => tra('Highlight words on the result pages based on the search query.'),
359			'type' => 'flag',
360			'default' => 'y',
361			'tags' => ['basic'],
362		],
363		'unified_search_textarea_admin' => [
364			'name' => tra('Plugins tab of the textarea control panel loads with an empty list'),
365			'description' => tra('Improve the performance of the textarea control panel by avoiding the loading of all plugins initially'),
366			'type' => 'flag',
367			'default' => 'n',
368			'dependencies' => [
369				'feature_search',
370			],
371			'tags' => ['experimental'], // See warning
372			'warning' => tra('Some plugins may not appear. When using the MySQL engine, can have problems with short plugin names (for MyISAM, those under "ft_min_word_len").'), // See ticket #6313
373		],
374		'unified_elastic_possessive_stemmer' => [
375			'name' => tr('Possessive Stemmer'),
376			'description' => tr("The possessive stemmer removes possessives (trailing \"'s\") from words before indexing them."),
377			'type' => 'flag',
378			'default' => 'y',
379		],
380		'unified_list_cache_default_on' => [
381			'name' => tra('LIST plugin cache default on'),
382			'description' => tra('If selected, LIST plugins will be cached by default unless turned off at plugin level.'),
383			'type' => 'flag',
384			'default' => 'n',
385			'tags' => ['advanced'],
386			'help' => 'PluginList',
387		],
388		'unified_list_cache_default_expiry' => [
389			'name' => tra('LIST plugin cache default expiry'),
390			'description' => tra('Default number of minutes for LIST plugin cache expiry.'),
391			'type' => 'text',
392			'default' => '30',
393			'tags' => ['advanced'],
394			'help' => 'PluginList',
395		],
396		'unified_last_rebuild_stats' => [
397			'name' => tra('Last rebuild statistics'),
398			'description' => tra('Record of last rebuild object counts and timings.'),
399			'hint' => tra('Do not change this value unless you know what you are doing.'),
400			'type' => 'text',
401			'default' => [],
402			'tags' => ['advanced'],
403		],
404	];
405}
406