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_search_list()
9{
10	global $prefs;
11	return  [
12		'search_parsed_snippet' => [
13			'name' => tra('Parse search results'),
14			'warning' => tra('May impact performance'),
15			'description' => tra('When enabled search results are parsed so content formatting is visible in the search results'),
16			'type' => 'flag',
17			'default' => 'y',
18		],
19		'search_default_where' => [
20			'name' => tra('Default where'),
21			'description' => tra('When object filter is not on, limit to search one type of object'),
22			'type' => 'multicheckbox',
23			'options' => isset($prefs['feature_search_fulltext']) && $prefs['feature_search_fulltext'] === 'y' ?
24					[
25						'' => tra('Entire site'),
26						'wikis' => tra('Wiki Pages'),
27						'trackers' => tra('Trackers'),
28					] : [
29						'' => tra('Entire site'),
30						'wiki page' => tra('Wiki pages'),
31						'blog post' => tra('Blog posts'),
32						'article' => tra('Articles'),
33						'file' => tra('Files'),
34						'forum post' => tra('Forums'),
35						'trackeritem' => tra('Tracker items'),
36						'sheet' => tra('Spreadsheets'),
37					],
38			'default' => [],
39		],
40		'search_default_interface_language' => [
41			'name' => tra('Restrict search language by default'),
42			'description' => tra('Only search content that is in the interface language, otherwise show the language menu.'),
43			'type' => 'flag',
44			'dependencies' => ['feature_multilingual'],
45			'default' => 'n',
46		],
47		'search_autocomplete' => [
48			'name' => tra('Autocomplete page names'),
49			'description' => tr('Automatically complete page names as the user starts typing. For example the user types the start of the wiki page name “Sear” and Tiki returns “Search”, “Search General Settings”, etc'),
50			'type' => 'flag',
51			'dependencies' => ['feature_jquery_autocomplete', 'javascript_enabled'],
52			'warning' => tra('deprecated'),
53			'default' => 'n',
54			'tags' => ['deprecated'],
55		],
56		'search_show_category_filter' => [
57			'name' => tra('Category filter'),
58			'type' => 'flag',
59			'default' => 'n',
60			'dependencies' => [
61				'feature_categories',
62			],
63			'tags' => ['basic'],
64		],
65		'search_show_tag_filter' => [
66			'name' => tra('Tag filter'),
67			'type' => 'flag',
68			'default' => 'n',
69			'dependencies' => [
70				'feature_freetags',
71			],
72			'tags' => ['basic'],
73		],
74		'search_show_sort_order' => [
75			'name' => tra('Sort order'),
76			'type' => 'flag',
77			'default' => 'n',
78			'tags' => ['basic'],
79		],
80		'search_use_facets' => [
81			'name' => tra('Use facets for default search interface'),
82			'description' => tra('Facets are dynamic filters generated by the search engine to refine the search results. The feature may not be supported for all search engines.'),
83			'type' => 'flag',
84			'default' => 'n',
85		],
86		'search_facet_default_amount' => [
87			'name' => tra('Facet result count'),
88			'description' => tra('Default number of facet results to obtain'),
89			'type' => 'text',
90			'size' => 8,
91			'filter' => 'digits',
92			'units' => tra('facet results'),
93			'default' => '10',
94			'dependencies' => [
95				'search_use_facets',
96			],
97		],
98		'search_index_outdated' => [
99			'name' => tra('Search index outdated'),
100			'description' => tra('Number of days to consider the search index outdated'),
101			'type' => 'text',
102			'size' => 8,
103			'filter' => 'digits',
104			'default' => '2',
105			'units' => tra('days'),
106			'tags' => ['basic'],
107		],
108		'search_error_missing_field' => [
109			'name' => tra('Show error on missing field'),
110			'description' => tra('When using List plugin to specify certain fields, especially tracker fields, this check helps ensure their names were entered correctly.'),
111			'type' => 'flag',
112			'default' => 'y',
113		],
114		'search_file_thumbnail_preview' => [
115			'name' => tra('File thumbnail preview'),
116			'description' => tra('Have a preview of attachments in search results'),
117			'type' => 'flag',
118			'packages_required' => ['media-alchemyst/media-alchemyst' => 'MediaAlchemyst\Alchemyst'],
119			'default' => 'n',
120		],
121		'search_date_facets' => [
122			'name' => tra('Use date histogram aggregations'),
123			'description' => tr('Use date histogram aggregations (facets) when indexing, requires Elasticsearch'),
124			'type' => 'flag',
125			'default' => 'n',
126			'dependencies' => [
127				'search_use_facets',
128			],
129		],
130		'search_date_facets_interval' => [
131			'name' => tra('Date histogram aggregations interval'),
132			'description' => tr('Default interval for date histogram aggregations.') . '<br>' .
133				tr('Use "year, quarter, month, week, day, hour, minute, second" or Elasticsearch Time units as descibed here %0',
134					'https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#time-units'),
135			'type' => 'text',
136			'default' => 'year',
137			'dependencies' => [
138				'search_date_facets',
139			],
140		],
141		'search_date_facets_ranges' => [
142			'name' => tra('Date range aggregations ranges'),
143			'description' => tr('Default ranges for date range aggregations.') . '<br>' .
144				tr('Comma separated ranges, one per line using Elasticsearch Time date math as descibed here %0',
145					'https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#date-math'),
146			'type' => 'textarea',
147			'default' => "
148now-2y/y,now-1y/y,Last Year
149now-1y/y,now,This Year
150now-1m/m,now/m,Last Month
151now/d,now+1d/d,Today
152now+1d/d,now+2d/d,Tomorrow
153now/w,now+1w/w,Next Week
154now/m,now+1m/m,Next Month
155",
156			'dependencies' => [
157				'search_date_facets',
158			],
159		],
160		'search_excluded_facets' => [
161			'name' => tra('Excluded facets'),
162			'description' => tra('List of facets (a.k.a. aggregations) to exclude from the default search results'),
163			'hint' => 'For example: object_type,title_initial,title_firstword,tracker_field_userName',
164			'type' => 'text',
165			'filter' => 'word',
166			'separator' => ',',
167			'default' => [],
168			'dependencies' => [
169				'search_use_facets',
170			],
171		],
172		'search_avoid_duplicated_facet_labels' => [
173			'name' => tra('Avoid Duplicated Facets'),
174			'description' => tra('Avoid Facets appearing with the same name, usually by appending the Tracker name.'),
175			'type' => 'flag',
176			'filter' => 'alpha',
177			'default' => 'y',
178			'dependencies' => [
179				'search_use_facets',
180			],
181		],
182	];
183}
184