1{extends "layout_view.tpl"}
2
3{block name="title"}
4	{title}{$title}{/title}
5{/block}
6
7{block name="content"}
8	{if $prefs.unified_last_rebuild}
9		<div class="alert alert-warning">
10			<p>{tr _0=$prefs.unified_last_rebuild|tiki_long_datetime}Your index was last fully rebuilt on %0.{/tr}</p>
11		</div>
12	{/if}
13
14	{if !empty($search_engine)}
15		<div class="alert alert-info">
16			<p>{tr}Unified search engine:{/tr} <b>{$search_engine}</b>{if !empty($search_version)}, {tr}version{/tr} <b>{$search_version}</b>{/if}{if $search_index}, index <b>{$search_index}</b>{/if}</p>
17			{if $fallback_search_set && !empty($fallback_search_engine)}
18				<p>{tr}Unified search engine fallback:{/tr} <b>{$fallback_search_engine}</b>{if !empty($fallback_search_version)}, {tr}version{/tr} <b>{$fallback_search_version}</b>{/if}{if $fallback_search_index}, index <b>{$fallback_search_index}</b>{/if}</p>
19			{/if}
20		</div>
21	{/if}
22
23	{if !empty($stat)}
24		{remarksbox type='feedback' title="{tr}Indexed{/tr}"}
25			<ul>
26				{foreach from=$stat key=what item=nb}
27					<li>{$what|escape}: {$nb|escape}</li>
28				{/foreach}
29			</ul>
30		{/remarksbox}
31		{if $fallback_search_set}
32			{if $fallback_search_indexed}
33				{remarksbox type='feedback' title="{tr}Fallback search engine{/tr}"}
34					<p>{tr}Fallback search index was rebuild.{/tr}</p>
35				{/remarksbox}
36			{else}
37				{remarksbox type='error' title="{tr}Fallback search engine{/tr}"}
38					<p>{tr}Fallback search index was not rebuilt.{/tr}</p>
39				{/remarksbox}
40			{/if}
41		{/if}
42		{remarksbox type='feedback' title="{tr}Execution Statistics{/tr}"}
43			<ul>
44				<li>{tr}Execution time:{/tr} {$execution_time}</li>
45				<li>{tr}Current Memory usage:{/tr} {$memory_usage}</li>
46				<li>{tr}Memory peak usage before indexing:{/tr} {$memory_peak_usage_before}</li>
47				<li>{tr}Memory peak usage after indexing:{/tr} {$memory_peak_usage_after}</li>
48				<li>{tr}Number of queries:{/tr} {$num_queries}</li>
49			</ul>
50		{/remarksbox}
51	{else}
52		<form method="post" class="no-ajax" action="{service controller=search action=rebuild}" onsubmit="$(this).parent().tikiModal('{tr}Rebuilding index...{/tr}')">
53			<div class="form-group row mx-2">
54				<div class="form-check">
55					<label class="form-check-label">
56						<input type="checkbox" class="form-check-input" name="loggit" value="1">
57						{tr}Enable logging{/tr}
58					</label>
59					<div class="form-text">{tr _0=$log_file_browser}Log file is saved as %0{/tr}</div>
60				</div>
61			</div>
62			<div class="form-group submit">
63				<input type="submit" class="btn btn-primary" value="{tr}Rebuild{/tr}">
64				{if $queue_count > 0}
65					<a class="btn btn-primary" href="{service controller=search action=process_queue}">{tr}Process Queue{/tr} <span class="badge badge-secondary">{$queue_count|escape}</span></a>
66				{/if}
67			</div>
68		</form>
69
70		{* If the indexing succeeded, there are clearly no problems, free up some screen space *}
71		{remarksbox type=tip title="{tr}Indexing Problems?{/tr}"}
72			<p>{tr}If the indexing does not complete, check the log file to see where it ended.{/tr}</p>
73			<p style="overflow-wrap: break-word">{tr}Last line of log file (web):{/tr} <strong>{$lastLogItemWeb|escape}</strong></p>
74			<p style="overflow-wrap: break-word">{tr}Last line of log file (console):{/tr} <strong>{$lastLogItemConsole|escape}</strong></p>
75
76			<p>Common failures include:</p>
77			<ul>
78				<li><strong>{tr}Not enough memory.{/tr}</strong> Larger sites require more memory to re-index.</li>
79				<li><strong>{tr}Time limit too short.{/tr}</strong> It may be required to run the rebuild through the command line.</li>
80				<li><strong>{tr}High resource usage.{/tr}</strong> Some plugins in your pages may cause excessive load. Blacklisting some plugins during indexing can help.</li>
81			</ul>
82		{/remarksbox}
83
84		{remarksbox type=tip title="{tr}Command Line Utilities{/tr}"}
85			<kbd>php console.php{if not empty($tikidomain)} --site={$tikidomain|replace:'/':''}{/if} index:optimize</kbd><br>
86			<kbd>php console.php{if not empty($tikidomain)} --site={$tikidomain|replace:'/':''}{/if} index:rebuild</kbd><br>
87			<kbd>php console.php{if not empty($tikidomain)} --site={$tikidomain|replace:'/':''}{/if} index:rebuild --log</kbd><br>
88			<p>{tr _0=$log_file_console}Log file is saved as %0{/tr}</p>
89		{/remarksbox}
90	{/if}
91{/block}
92