VIVO-873 Adapt the client code to the new interface.

Create a bridge implementation of SearchIndexerImpl that just wraps around an old IndexBuilder.

Modify client code:
Application, BasicAuthenticator, SearchServiceController, SparqlUpdateApiController,
UpdateUrisInIndex and VClassGroupCache

Rewrite IndexController to use AJAX and to show the current status and history of the indexer events.
This commit is contained in:
Jim Blake 2015-01-07 16:18:41 -05:00
parent 3bc42c1456
commit 2ceab6e3df
21 changed files with 1038 additions and 204 deletions

View file

@ -1,43 +1,21 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
Template for the page that controls the updating or rebuilding of the Search Index.
Template for the page that displays the status of the Search Indexer.
Most of it is provided by the AJAX call.
-->
<h2>${i18n().search_index_status}</h2>
<#if !indexIsConnected>
<!-- Can't contact the search engine. Indexing would be impossible. Show an error message. -->
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alt="Error alert icon" />
<p>${i18n().search_index_not_connected}</p>
<p><tt>SearchEngine.ping()</tt> ${i18n().failed}.
<p>${i18n().check_startup_status}</p>
</section>
<#elseif worklevel == "IDLE">
<!-- Search indexer is idle. Show the button that rebuilds the index. -->
<h3>${i18n().search_indexer_idle}</h3>
<#if hasPreviousBuild??>
<p>${i18n().most_recent_update} ${since?string("hh:mm:ss a, MMMM dd, yyyy")}</p>
</#if>
<form action="${actionUrl}" method="POST">
<p>
<input class="submit" type="submit" name="rebuild" value="${i18n().rebuild_button}" role="button" />
${i18n().reset_search_index}
</p>
</form>
<#elseif totalToDo == 0>
<!-- Search indexer is preparing the list of records. Show elapsed time since request. -->
<h3>${i18n().preparing_to_rebuild_index}</h3>
<p>${i18n().since_elapsed_time(since?string("hh:mm:ss a, MMMM dd, yyyy"),elapsed)}</p>
<#else>
<!-- Search indexer is re-building the index. Show the progress. -->
<h3>${i18n().current_task(currentTask)}</h3>
<p>${i18n().since_elapsed_time_est_total(since?string("hh:mm:ss a, MMMM dd, yyyy"),elapsed,expected)}</p>
<p>${i18n().index_recs_completed(completedCount,totalToDo)}</p>
</#if>
<div id="searchIndexerStatus">
Search Indexer Status
</div>
<script>
searchIndexerStatusUrl = '${statusUrl}'
</script>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/search/searchIndex.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/search/searchIndex.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>')}

View file

@ -0,0 +1,72 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
Template for the page that controls the updating or rebuilding of the Search Index.
-->
<section id="indexer" role="region">
<#if status.statusType == "IDLE">
<h3>The search indexer has been idle since ${status.since?datetime}</h3>
<#elseif status.statusType = "PROCESSING_URIS">
<h3>The search indexer has been processing URIs since ${status.since?datetime}</h3>
<p><@showIndexerCounts "URI_COUNTS", status /></p>
<p><@showElapsedTime status.elapsed /> Expected completion ${status.expectedCompletion?datetime}.</p>
<#elseif status.statusType = "PROCESSING_STMTS">
<h3>The search indexer has been processing changed statements since ${status.since?datetime}</h3>
<p><@showIndexerCounts "STATEMENT_COUNTS", status /></p>
<p><@showElapsedTime status.elapsed /> Expected completion ${status.expectedCompletion?datetime}.</p>
<#elseif status.statusType = "PREPARING_REBUILD">
<h3>The search indexer has been preparing to rebuild the index since ${status.since?datetime}</h3>
<#else>
<h3>The search indexer status is: ${status.statusType}
</#if>
<form action="${rebuildUrl}" method="POST">
<p>
<#if status.statusType == "IDLE">
<input class="submit" type="submit" name="rebuild" value="${i18n().rebuild_button}" role="button" />
${i18n().reset_search_index}
</#if>
</p>
</form>
<h3>History</h3>
<table class="history">
<tr> <th>Event</th> <th>Status</th> <th>Since</th> <th>Counts</th> </tr>
<#list history as ie>
<@showIndexerEvent ie />
</#list>
</table>
</section>
<#macro showElapsedTime elapsed>
Elapsed time ${elapsed[0]}:${elapsed[1]}:${elapsed[2]}.
</#macro>
<#macro showIndexerEvent event>
<tr>
<td>${event.event}</td>
<td>${event.statusType}</td>
<td>${event.since?datetime}</td>
<td><@showIndexerCounts event.countsType, event /></td>
</tr>
</#macro>
<#macro showIndexerCounts countsType, counts>
<#if countsType == "URI_COUNTS">
Updated: ${counts.updated}, deleted: ${counts.deleted}, remaining: ${counts.remaining}, total: ${counts.total}
<#elseif countsType == "STATEMENT_COUNTS">
Processed: ${counts.processed}, remaining: ${counts.remaining}, total: ${counts.total}
<#elseif countsType == "REBUILD_COUNTS">
Number of individuals before rebuild: ${counts.numberOfIndividuals}
</#if>
</#macro>