Revision: 17284
http://sourceforge.net/p/gate/code/17284
Author: valyt
Date: 2014-02-11 16:28:24 +0000 (Tue, 11 Feb 2014)
Log Message:
-----------
Index.state values SEARCHING and INDEXING have now been combined into a single
value READY.
Index.closingProgress() call has been removed.
Modified Paths:
--------------
mimir/branches/5.0/mimir-cloud/.classpath
mimir/branches/5.0/mimir-cloud/grails-app/services/gate/mimir/cloud/IndexArchiveService.groovy
mimir/branches/5.0/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
mimir/branches/5.0/mimir-web/.classpath
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/FederatedIndexController.groovy
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/FederatedIndexService.groovy
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/LocalIndexService.groovy
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/RemoteIndexService.groovy
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
mimir/branches/5.0/mimir-web/grails-app/views/common/_indexLinks.gsp
mimir/branches/5.0/mimir-web/grails-app/views/federatedIndex/list.gsp
mimir/branches/5.0/mimir-web/grails-app/views/indexAdmin/admin.gsp
mimir/branches/5.0/mimir-web/grails-app/views/localIndex/list.gsp
mimir/branches/5.0/mimir-web/grails-app/views/mimirStaticPages/admin.gsp
mimir/branches/5.0/mimir-web/grails-app/views/remoteIndex/list.gsp
mimir/branches/5.0/mimir-web/grails-app/views/search/info.gsp
Modified: mimir/branches/5.0/mimir-cloud/.classpath
===================================================================
--- mimir/branches/5.0/mimir-cloud/.classpath 2014-02-11 16:18:00 UTC (rev
17283)
+++ mimir/branches/5.0/mimir-cloud/.classpath 2014-02-11 16:28:24 UTC (rev
17284)
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
- <classpathentry kind="con"
path="org.grails.ide.eclipse.core.CLASSPATH_CONTAINER"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/groovy"/>
<classpathentry kind="src" path="grails-app/conf"/>
@@ -13,6 +12,7 @@
<classpathentry kind="src" path="grails-app/utils"/>
<classpathentry kind="src" path="test/integration"/>
<classpathentry kind="src" path="test/unit"/>
+ <classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="src"
path=".link_to_grails_plugins/background-thread-1.6/grails-app/services">
<attributes>
<attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
@@ -148,21 +148,11 @@
<attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
- <classpathentry
excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy"
kind="src" path=".link_to_grails_plugins/webxml-1.4.1/grails-app/conf">
- <attributes>
- <attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src"
path=".link_to_grails_plugins/webxml-1.4.1/src/groovy">
- <attributes>
- <attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
- </attributes>
- </classpathentry>
<classpathentry exported="true" kind="src" path="/mimir-web">
<attributes>
<attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
+ <classpathentry kind="con"
path="org.grails.ide.eclipse.core.CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target-eclipse/classes"/>
</classpath>
Modified:
mimir/branches/5.0/mimir-cloud/grails-app/services/gate/mimir/cloud/IndexArchiveService.groovy
===================================================================
---
mimir/branches/5.0/mimir-cloud/grails-app/services/gate/mimir/cloud/IndexArchiveService.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-cloud/grails-app/services/gate/mimir/cloud/IndexArchiveService.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -244,7 +244,7 @@
} finally {
IndexArchive.withTransaction() {
// re-start the index in searching mode
- indexArchive.theIndex.state = Index.SEARCHING
+ indexArchive.theIndex.state = Index.READY
indexArchive.theIndex.save(flush:true, failOnError:true)
}
}
Modified: mimir/branches/5.0/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
===================================================================
--- mimir/branches/5.0/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -9,33 +9,6 @@
<title>Mimir index "${indexInstance.name}"</title>
<mimir:load/>
- <g:if test="${indexInstance.state == Index.CLOSING}">
- <g:javascript src="json2.min.js" plugin="mimir-web" />
- <g:javascript>
- function updateProgress() {
- <g:remoteFunction
- url="[controller:'indexAdmin', action:'closingProgress',
params:[indexId:indexInstance.indexId]]"
- method="GET" onSuccess="doProgressUpdate(e)"
- onFailure="progressUpdateFailed(e)" />;
- }
-
- function doProgressUpdate(response) {
- var result = JSON.parse(response.responseText);
- if(result.complete) {
- window.location.reload();
- } else {
- document.getElementById('closingProgress-bar').style.width =
result.progress;
- document.getElementById('closingProgress-value').innerHTML =
result.progress;
- setTimeout(updateProgress, 5000);
- }
- }
-
- function progressUpdateFailed(response) {
- var progValue = document.getElementById('closingProgress-value');
- progValue.innerHTML = progValue.innerHTML + ' (unable to update
dynamically, please reload to check progress)';
- }
- </g:javascript>
- </g:if>
</head>
<body>
<div class="nav">
@@ -100,7 +73,7 @@
</tr>
</g:if>
- <g:if test="${indexInstance.state == Index.SEARCHING}">
+ <g:if test="${indexInstance.state == Index.READY}">
<tr class="${row++ % 2 == 0 ? 'even' :'odd'}">
<td colspan="2">
<g:link controller="search" action="index"
@@ -115,12 +88,6 @@
</td>
</tr>
</g:if>
- <g:elseif test="${indexInstance.state == Index.CLOSING}">
- <tr class="${row++ % 2 == 0 ? 'even' :'odd'}">
- <td>Index Closing Progress:</td>
- <td><mimir:progressbar id="closingProgress"
value="${indexInstance.closingProgress()}"
/><g:javascript>setTimeout(updateProgress, 5000);</g:javascript></td>
- </tr>
- </g:elseif>
</tbody>
</table>
</div>
@@ -143,17 +110,7 @@
onclick="return confirm('Are you sure?');" value="Delete" />
</span></td>
</g:form>
- <g:if test="${indexInstance.state == Index.INDEXING}">
- <g:form action="close" params="[indexId:indexInstance?.indexId]">
- <input type="hidden" name="indexId"
value="${indexInstance?.indexId}" />
- <td><span class="button">
- <g:submitButton class="close"
- title="Click to stop the indexing process and prepare this
index for searching."
- onclick="return confirm('Are you sure?');" name="Close"/>
- </span></td>
- </g:form>
- </g:if>
- <g:elseif test="${indexInstance instanceof gate.mimir.web.LocalIndex
&& indexInstance.state == Index.SEARCHING}">
+ <g:if test="${indexInstance instanceof gate.mimir.web.LocalIndex &&
indexInstance.state == Index.READY}">
<g:form action="download" controller="indexDownload"
id="${indexInstance?.id}" method="GET">
<td><span class="button"><input type="submit" class="download"
value="Download"
title="Click to download this index." />
@@ -166,7 +123,7 @@
value="[Re-]Archive and Download"/>
</span></td>
</g:form>
- </g:elseif>
+ </g:if>
</tr>
</table>
</div>
Modified: mimir/branches/5.0/mimir-web/.classpath
===================================================================
--- mimir/branches/5.0/mimir-web/.classpath 2014-02-11 16:18:00 UTC (rev
17283)
+++ mimir/branches/5.0/mimir-web/.classpath 2014-02-11 16:28:24 UTC (rev
17284)
@@ -98,17 +98,5 @@
<attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
- <classpathentry
excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy"
kind="src" path=".link_to_grails_plugins/webxml-1.4.1/grails-app/conf">
- <attributes>
- <attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src"
path=".link_to_grails_plugins/webxml-1.4.1/src/groovy">
- <attributes>
- <attribute
name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry combineaccessrules="false" kind="src"
path="/mimir-client"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/mimir-core"/>
<classpathentry kind="output" path="target-eclipse/classes"/>
</classpath>
Modified:
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/FederatedIndexController.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/FederatedIndexController.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/FederatedIndexController.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -130,7 +130,7 @@
//make sure the proxy is created
federatedIndexService.findProxy(federatedIndexInstance)
flash.message = "FederatedIndex \"${federatedIndexInstance.name}\"
created"
- if(federatedIndexInstance.state == Index.INDEXING) {
+ if(federatedIndexInstance.state == Index.READY) {
federatedIndexService.registerIndex(federatedIndexInstance)
}
redirect(controller:'mimirStaticPages', action: 'admin')
Modified:
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexAdminController.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -43,21 +43,6 @@
[indexInstance:indexInstance]
}
- def closingProgress = {
- def indexInstance = Index.findByIndexId(params.indexId)
- if(!indexInstance) {
- render("No such index ${params.indexId}")
- return
- }
-
- double progress = indexInstance.closingProgress()
- if(indexInstance.state == Index.CLOSING) {
- render([progress:percentNumberInstance.format(progress)] as JSON)
- } else {
- render([complete:true] as JSON)
- }
- }
-
def close = {
def indexInstance = Index.findByIndexId(params.indexId)
@@ -68,7 +53,7 @@
if(indexInstance.state == Index.CLOSING) {
flash.message = "Index \"${indexInstance.name}\" is already in the
process of closing."
}
- else if(indexInstance.state == Index.INDEXING) {
+ else if(indexInstance.state == Index.READY) {
indexInstance.close()
flash.message = "Index \"${indexInstance.name}\" closing. This may
take a long time."
}
@@ -83,8 +68,8 @@
flash.message = "Index not found with index id ${params.indexId}"
redirect(action:admin, params:params)
}
- else if(indexInstance.state != Index.SEARCHING) {
- flash.message = "Index \"${indexInstance.name}\" is not in the searching
state"
+ else if(indexInstance.state != Index.READY) {
+ flash.message = "Index \"${indexInstance.name}\" is not open"
redirect(action:admin, params:params)
}
else {
@@ -103,8 +88,8 @@
flash.message = "Index not found with index id ${params.indexId}"
redirect(action:admin, params:params)
}
- else if(indexInstance.state != Index.SEARCHING) {
- flash.message = "Index \"${indexInstance.name}\" is not in the searching
state"
+ else if(indexInstance.state != Index.READY) {
+ flash.message = "Index \"${indexInstance.name}\" is not open"
redirect(action:admin, params:params)
}
else {
Modified:
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/IndexManagementController.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -35,44 +35,19 @@
def indexUrl = {
def theIndex = Index.findByIndexId(params.indexId)
if(theIndex) {
- if(theIndex.state == Index.INDEXING) {
- render(text:theIndex.indexUrl(), contentType:"text/plain",
- encoding:"UTF-8")
- } else {
- response.sendError(HttpServletResponse.SC_FORBIDDEN,
- "Index with ID ${params.indexId} is in state ${theIndex.state}")
- }
+ render(text:theIndex.indexUrl(), contentType:"text/plain",
+ encoding:"UTF-8")
}
}
def close = {
def theIndex = Index.findByIndexId(params.indexId)
if(theIndex) {
- if(theIndex.state == Index.INDEXING) {
- theIndex.close()
- render("OK")
- } else {
- response.sendError(HttpServletResponse.SC_FORBIDDEN,
- "Index with ID ${params.indexId} is in state ${theIndex.state}")
- }
+ theIndex.close()
+ render("OK")
}
}
- def closingProgressBin = {
- try {
- def theIndex = Index.findByIndexId(params.indexId)
- if(theIndex) {
- double value = theIndex.closingProgress()
- new ObjectOutputStream (response.outputStream).withStream {stream ->
- stream.writeDouble(value)
- }
- }
- } catch(Exception e){
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error while obtaining the closing progress: \"" + e.getMessage() +
"\"!")
- }
- }
-
/**
* Takes a binary serialization of one or more GATE documents on the input
* stream, deserializes it and passes it to the indexer.
@@ -80,15 +55,10 @@
def addDocuments = {
def theIndex = Index.findByIndexId(params.indexId)
if(theIndex) {
- if(theIndex.state == Index.INDEXING) {
- request.inputStream.withStream { stream ->
- theIndex.indexDocuments(stream)
- }
- render("OK")
- } else {
- response.sendError(HttpServletResponse.SC_FORBIDDEN,
- "Index with ID ${params.indexId} is in state ${theIndex.state}")
+ request.inputStream.withStream { stream ->
+ theIndex.indexDocuments(stream)
}
+ render("OK")
}
}
Modified:
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -177,7 +177,7 @@
def localIndexInstance = new LocalIndex(indexId:indexId)
localIndexInstance.name = params.name
localIndexInstance.uriIsExternalLink = params.uriIsExternalLink ? true :
false
- localIndexInstance.state = Index.INDEXING
+ localIndexInstance.state = Index.READY
try {
def mimirConfigurationInstance =
MimirConfiguration.findByIndexBaseDirectoryIsNotNull()
if(!mimirConfigurationInstance) {
@@ -234,7 +234,7 @@
localIndexInstance.name = params.name
localIndexInstance.uriIsExternalLink = params.uriIsExternalLink ? true :
false
localIndexInstance.indexDirectory = params.indexDirectory
- localIndexInstance.state = Index.SEARCHING
+ localIndexInstance.state = Index.READY
// sanity check that the specified directory exists and has the right
// stuff in it
def indexDir = new File(params.indexDirectory)
Modified:
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -72,18 +72,18 @@
def beforeInterceptor = {
def theIndex = Index.findByIndexId(params.indexId)
if(theIndex) {
- if(theIndex.state == Index.SEARCHING) {
+ if(theIndex.state == Index.READY) {
request.theIndex = theIndex
return true
}
- else if(theIndex.state == Index.INDEXING) {
- response.sendError(HttpServletResponse.SC_FORBIDDEN,
- "Index with ID ${params.indexId} is open for indexing, not
searching. Please close the index, then try your search again.")
- }
else if(theIndex.state == Index.CLOSING) {
response.sendError(HttpServletResponse.SC_FORBIDDEN,
"Index with ID ${params.indexId} is in the process of closing")
}
+ else {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN,
+ "Index with ID ${params.indexId} is not ready")
+ }
}
else {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "No index with ID
${params.indexId}")
Modified:
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/FederatedIndex.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -120,10 +120,6 @@
//all subindexes have the same config
return indexes[0].annotationsConfig()
}
-
- public double closingProgress() {
- return federatedIndexService.findProxy(this).closingProgress
- }
public void deleteDocuments(Collection<Long> documentIds) {
federatedIndexService.deleteDocuments(this, documentIds)
Modified:
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/Index.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -33,11 +33,14 @@
*/
String indexId
+
+ String state
+
/**
- * Current state of this index.
+ * The custom CSS injected in the results page produced by this index. This
+ * allows the user customisation of how results are presented (in concert
with
+ * suitable HTML tags being stored at indexing time).
*/
- String state
-
String css
/**
@@ -86,14 +89,6 @@
}
/**
- * Obtain the progress of the index closing operation if one is currently
- * running, or 1 otherwise.
- */
- double closingProgress() {
- throw new UnsupportedOperationException()
- }
-
- /**
* Return the annotation configuration for this index, as used for
* autocompletion in gus.
*/
@@ -154,8 +149,7 @@
}
// Constants for the possible state values
- public static final String INDEXING = "indexing"
- public static final String SEARCHING = "searching"
+ public static final String READY = "ready" // good for searching and indexing
public static final String CLOSING = "closing"
public static final String WORKING = "working"
public static final String FAILED = "failed"
Modified:
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/LocalIndex.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -15,6 +15,7 @@
import java.io.Writer;
+import gate.mimir.MimirIndex;
import gate.mimir.index.DocumentData
import gate.mimir.search.QueryRunner
import gate.mimir.search.query.QueryNode;
@@ -69,9 +70,9 @@
}
void indexDocuments(InputStream stream) {
- def indexer = localIndexService.findIndexer(this)
- if(!indexer) {
- throw new IllegalStateException("Cannot find indexer for index ${this}")
+ MimirIndex mIndex = localIndexService.getIndex(this)
+ if(!mIndex) {
+ throw new IllegalStateException("Cannot open index for index ${this}")
}
new ObjectInputStream(stream).withStream { objectStream ->
@@ -79,7 +80,7 @@
ResourceData rd = Gate.creoleRegister[doc.getClass().name]
if(rd) {
rd.addInstantiation(doc)
- indexer.indexDocument(doc)
+ mIndex.indexDocument(doc)
}
else {
throw new ResourceInstantiationException(
@@ -93,10 +94,6 @@
localIndexService.close(this)
}
- double closingProgress() {
- return localIndexService.closingProgress(this)
- }
-
String[][] annotationsConfig() {
return localIndexService.annotationsConfig(this)
}
Modified:
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/domain/gate/mimir/web/RemoteIndex.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -145,10 +145,6 @@
}
}
- public double closingProgress() {
- return remoteIndexService.findProxy(this).closingProgress
- }
-
String indexUrl() {
StringBuilder responseString = new StringBuilder()
String urlStr = (remoteUrl.endsWith("/") ? remoteUrl : (remoteUrl + "/"))
+
Modified:
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/FederatedIndexService.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/FederatedIndexService.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/FederatedIndexService.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -94,7 +94,7 @@
public void init() {
FederatedIndex.list().each {
findProxy(it)
- if(it.state == Index.INDEXING) registerIndex(it)
+ if(it.state == Index.READY) registerIndex(it)
}
}
@@ -267,8 +267,8 @@
// all the same so far
return cur
}
- else if([prev,cur].containsAll([Index.SEARCHING, Index.CLOSING])) {
- // we know prev != cur, if one is closing and the other searching then
+ else if([prev,cur].containsAll([Index.READY, Index.CLOSING])) {
+ // we know prev != cur, if one is closing and the other ready then
// some of our children have finished closing and some haven't
return Index.CLOSING
}
@@ -278,20 +278,12 @@
return Index.WORKING
}
}
-
- if(index.state == Index.CLOSING) {
- closingProgress = index.indexes.collect {
- (it.state == Index.CLOSING) ? it.closingProgress() : 1.0
- }.sum() / index.indexes.size()
- }
}
-
/**
* The hibernate ID of the index for which this proxy was created.
*/
def id
- double closingProgress = 0.0
private static final Logger log =
Logger.getLogger("grails.app.service.${FederatedIndexProxy.class.getName()}")
private static final int DELAY = 10000
boolean stop = false
Modified:
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/LocalIndexService.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/LocalIndexService.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/LocalIndexService.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -68,28 +68,17 @@
/**
* At startup, any indexes that are listed in the DB as being in any state
- * other than searching are now invalid, so need to be marked as failed.
+ * other than ready are now invalid, so need to be marked as failed.
*/
public void init() {
LocalIndex.withTransaction {
LocalIndex.list().each {
- if(it.state != Index.SEARCHING) {
+ if(it.state != Index.READY) {
it.state = Index.FAILED
}
}
}
}
-
- public synchronized MimirIndex findIndexer(LocalIndex index) {
- def indexer = indexes[index.id]
- if(!indexer) {
- if(index.state != Index.INDEXING) {
- throw new IllegalStateException(
- "Index ${index.indexId} is not open for indexing")
- }
- }
- return indexer
- }
/**
* Create a new index on disk from the given template in the directory
@@ -99,13 +88,13 @@
public synchronized MimirIndex createIndex(LocalIndex index, IndexTemplate
templ) {
def indexConfig = GroovyIndexConfigParser.createIndexConfig(
templ.configuration, new File(index.indexDirectory))
- MimirIndex indexer = new MimirIndex(indexConfig)
- indexes[index.id] = indexer
- return indexer
+ MimirIndex theIndex = new MimirIndex(indexConfig)
+ indexes[index.id] = theIndex
+ return theIndex
}
public void close(LocalIndex index) {
- if(index.state == Index.INDEXING) {
+ if(index.state == Index.READY) {
index.state = Index.CLOSING
index.save()
def indexId = index.id
@@ -114,7 +103,7 @@
indexes.remove(indexId)?.close()
LocalIndex.withTransaction { status ->
def theIndex = LocalIndex.get(indexId)
- theIndex.state = Index.SEARCHING
+ theIndex.state = Index.READY
theIndex.save()
}
}
@@ -127,50 +116,38 @@
}
}
}
- } else if(index.state == Index.SEARCHING) {
- indexes.remove(index.id)?.close()
-
}
}
- public double closingProgress(LocalIndex index) {
- try{
- return findIndexer(index).getClosingProgress()
- } catch (IllegalStateException e) {
- return 1.0d
- }
- }
-
public synchronized QueryRunner getQueryRunner(LocalIndex index, String
query)
throws ParseException {
- return getQueryEngine(index).getQueryRunner(query)
+ return getIndex(index).getQueryEngine().getQueryRunner(query)
}
public synchronized DocumentData getDocumentData(LocalIndex index, long
documentId) {
-println("Doc ID4 $documentId")
- return getQueryEngine(index).getIndex().getDocumentData(documentId)
+ return
getIndex(index).getQueryEngine().getIndex().getDocumentData(documentId)
}
public synchronized void renderDocument(LocalIndex index, long documentId,
Appendable out) {
- getQueryEngine(index).renderDocument(documentId, [], out)
+ getIndex(index).getQueryEngine().renderDocument(documentId, [], out)
}
public synchronized void deleteDocuments(LocalIndex index, Collection<Long>
documentIds) {
- getQueryEngine(index).getIndex().deleteDocuments(documentIds)
+ getIndex(index).getQueryEngine().getIndex().deleteDocuments(documentIds)
}
public synchronized void undeleteDocuments(LocalIndex index,
Collection<Long> documentIds) {
- getQueryEngine(index).getIndex().undeleteDocuments(documentIds)
+ getIndex(index).getQueryEngine().getIndex().undeleteDocuments(documentIds)
}
- public synchronized QueryEngine getQueryEngine (LocalIndex index){
+ public synchronized MimirIndex getIndex (LocalIndex index){
MimirIndex mIndex = indexes[index.id]
QueryEngine engine = null
if(mIndex) {
engine = mIndex.getQueryEngine()
- } else{
+ } else {
// index not yet open
try {
mIndex = new MimirIndex(new File(index.indexDirectory))
@@ -192,15 +169,13 @@
} else {
engine.setScorerSource(null)
}
- return engine
+ return mIndex
}
public String[][] annotationsConfig(LocalIndex index) {
IndexConfig indexConfig = null
- if(index.state == Index.INDEXING) {
- indexConfig = findIndexer(index)?.indexConfig
- } else if(index.state == Index.SEARCHING) {
- indexConfig = getQueryEngine(index)?.indexConfig
+ if(index.state == Index.READY) {
+ indexConfig = getIndex(index)?.indexConfig
}
if(indexConfig) {
SemanticIndexerConfig[] semIndexers = indexConfig.getSemanticIndexers();
@@ -271,9 +246,9 @@
@PreDestroy
public void destroy() {
// close the local indexes in a civilised fashion
- // (for indexes that are not in SEARCHING mode, there is no civilised way!)
+ // (for indexes that are not in READY mode, there is no civilised way!)
LocalIndex.list().each{ LocalIndex index ->
- if(index.state == Index.SEARCHING) close(index)
+ if(index.state == Index.READY) close(index)
}
}
}
Modified:
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/RemoteIndexService.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/RemoteIndexService.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/RemoteIndexService.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -83,7 +83,6 @@
* The hibernate ID of the index for which this proxy was created.
*/
def id
- double closingProgress = 0.0
boolean stop = false
@@ -94,7 +93,6 @@
RemoteIndex.withTransaction{
RemoteIndex index = RemoteIndex.get(id)
fetchRemoteState(index)
- if(index.state == Index.CLOSING) fetchClosingProgress(index)
}
Thread.sleep(DELAY)
}
@@ -112,16 +110,6 @@
}
}
- private fetchClosingProgress(RemoteIndex index) {
- try {
- closingProgress = webUtilsManager.currentWebUtils(index).getDouble(
- "${index.remoteUrl}/manage/closingProgressBin")
- }
- catch(IOException e) {
- log.error("Problem communicating with remote index", e)
- }
- }
-
public void close() {
stop = true
}
Modified:
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
===================================================================
---
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
2014-02-11 16:18:00 UTC (rev 17283)
+++
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
2014-02-11 16:28:24 UTC (rev 17284)
@@ -47,8 +47,8 @@
if(!index) {
throw new MimirSearchException("Invalid index ID ${indexId}")
}
- else if(index.state != Index.SEARCHING) {
- throw new MimirSearchException("Index ${indexId} is not open for
searching")
+ else if(index.state != Index.READY) {
+ throw new MimirSearchException("Index ${indexId} is not ready")
}
else {
String queryId = searchService.postQuery(index, query)
Modified: mimir/branches/5.0/mimir-web/grails-app/views/common/_indexLinks.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/common/_indexLinks.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/common/_indexLinks.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -6,7 +6,7 @@
<g:link controller="indexAdmin" action="admin"
params="[indexId:indexInstance.indexId]"
title='Click to manage ${indexName}'>${indexName}</g:link>
- <g:if test="${indexInstance.state == Index.SEARCHING}">
+ <g:if test="${indexInstance.state == Index.READY}">
(<g:link controller="search" action="info"
params="[indexId:indexInstance.indexId]"
title='Click to search ${indexName}'>search</g:link>)
Modified: mimir/branches/5.0/mimir-web/grails-app/views/federatedIndex/list.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/federatedIndex/list.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/federatedIndex/list.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -40,7 +40,7 @@
<td>${fieldValue(bean:federatedIndexInstance, field:'state')}
</td>
<td>
- <g:if
test='${federatedIndexInstance.state == Index.SEARCHING}'>
+ <g:if
test='${federatedIndexInstance.state == Index.READY}'>
<g:link controller="gus" action="search"
params="[indexId:federatedIndexInstance.indexId]">Search this index.</g:link>
Modified: mimir/branches/5.0/mimir-web/grails-app/views/indexAdmin/admin.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/indexAdmin/admin.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/indexAdmin/admin.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -9,34 +9,6 @@
<title>Mimir index "${indexInstance.name}"</title>
<mimir:load/>
-<g:if test="${indexInstance.state == Index.CLOSING}">
- <g:javascript src="json2.min.js" />
- <g:javascript>
- function updateProgress() {
- <g:remoteFunction
- url="[controller:'indexAdmin', action:'closingProgress',
params:[indexId:indexInstance.indexId]]"
- method="GET" onSuccess="doProgressUpdate(e)"
- onFailure="progressUpdateFailed(e)" />;
- }
-
- function doProgressUpdate(response) {
- var result = JSON.parse(response.responseText);
- if(result.complete) {
- window.location.reload();
- } else {
- document.getElementById('closingProgress-bar').style.width =
result.progress;
- document.getElementById('closingProgress-value').innerHTML =
result.progress;
- setTimeout(updateProgress, 5000);
- }
- }
-
- function progressUpdateFailed(response) {
- var progValue = document.getElementById('closingProgress-value');
- progValue.innerHTML = progValue.innerHTML + ' (unable to update
dynamically, please reload to check progress)';
- }
- </g:javascript>
-</g:if>
-
</head>
<body>
<div class="nav">
@@ -97,7 +69,7 @@
${indexInstance.scorer?:'No Scoring'}</td>
</tr>
</g:if>
- <g:if test="${indexInstance.state == Index.SEARCHING}">
+ <g:if test="${indexInstance.state == Index.READY}">
<tr class="prop">
<td colspan="2">
<g:link controller="search" action="index"
@@ -111,12 +83,6 @@
title="Add or remove 'deleted' markers for documents">Manage
deleted documents.</g:link></td>
</tr>
</g:if>
- <g:elseif test="${indexInstance.state == Index.CLOSING}">
- <tr class="prop">
- <td>Index Closing Progress:</td>
- <td><mimir:progressbar id="closingProgress"
value="${indexInstance.closingProgress()}"
/><g:javascript>setTimeout(updateProgress, 5000);</g:javascript></td>
- </tr>
- </g:elseif>
</tbody>
</table>
</div>
@@ -139,17 +105,6 @@
</span>
</td>
</g:form>
- <g:if test="${indexInstance.state == Index.INDEXING}">
- <g:form action="close" params="[indexId:indexInstance?.indexId]">
- <input type="hidden" name="indexId"
- value="${indexInstance?.indexId}" />
- <td><span class="button"> <g:submitButton
- class="close"
- title="Click to stop the indexing process and prepare this
index for searching."
- onclick="return confirm('Are you sure?');" name="Close" />
</span>
- </td>
- </g:form>
- </g:if>
</tr>
</table>
</div>
Modified: mimir/branches/5.0/mimir-web/grails-app/views/localIndex/list.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/localIndex/list.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/localIndex/list.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -9,8 +9,8 @@
<body>
<div class="nav">
<span class="menuButton"><g:link class="home"
controller="mimirStaticPages" action="admin">Admin Home</g:link></span>
- <span class="menuButton"><g:link class="create"
action="create">Create New Local Index for Indexing</g:link></span>
- <span class="menuButton"><g:link class="create"
action="importIndex">Import Existing Index for Searching</g:link>
+ <span class="menuButton"><g:link class="create"
action="create">Create New Local Index</g:link></span>
+ <span class="menuButton"><g:link class="create"
action="importIndex">Import Existing Index</g:link>
</div>
<div class="body">
<h1>Local Index List</h1>
@@ -36,7 +36,7 @@
<td>${fieldValue(bean:localIndexInstance,
field:'indexDirectory')}</td>
<td>${fieldValue(bean:localIndexInstance,
field:'scorer')}</td>
<td>
- <g:if
test='${localIndexInstance.state == Index.SEARCHING}'>
+ <g:if
test='${localIndexInstance.state == Index.READY}'>
<g:link
controller="gus" action="search"
params="[indexId:localIndexInstance.indexId]">Search this index.</g:link>
Modified:
mimir/branches/5.0/mimir-web/grails-app/views/mimirStaticPages/admin.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/mimirStaticPages/admin.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/mimirStaticPages/admin.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -59,7 +59,7 @@
<p>There are no local indexes configured in this Mímir
instance.</p>
</g:else>
<p>You can <g:link controller="localIndex" action="create">create a new
local index</g:link>, or
- <g:link controller="localIndex" action="importIndex">import an existing
index for searching</g:link>.</p>
+ <g:link controller="localIndex" action="importIndex">import an existing
index</g:link>.</p>
<h3>Remote Indexes <span style="font-size:small;" title="Click for more
information!">(<mimir:revealAnchor
id="help3">?</mimir:revealAnchor>)</span></h3>
<mimir:revealBlock id="help3"><p class="help">Remote indexes are indexes
managed by a different
Modified: mimir/branches/5.0/mimir-web/grails-app/views/remoteIndex/list.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/remoteIndex/list.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/remoteIndex/list.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -45,7 +45,7 @@
<td>${fieldValue(bean:remoteIndexInstance, field:'state')}</td>
<td>
- <g:if
test='${remoteIndexInstance.state == Index.SEARCHING}'>
+ <g:if
test='${remoteIndexInstance.state == Index.READY}'>
<g:link controller="gus" action="search"
params="[indexId:remoteIndexInstance.indexId]">Search this
index.</g:link>
Modified: mimir/branches/5.0/mimir-web/grails-app/views/search/info.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/search/info.gsp
2014-02-11 16:18:00 UTC (rev 17283)
+++ mimir/branches/5.0/mimir-web/grails-app/views/search/info.gsp
2014-02-11 16:28:24 UTC (rev 17284)
@@ -12,7 +12,7 @@
<div class="message">${flash.message}</div>
</g:if>
<h1>Mimir index "${indexInstance.name}"</h1>
- <g:if test="${indexInstance.state == Index.SEARCHING}">
+ <g:if test="${indexInstance.state == Index.READY}">
<p><g:link action="index" params="[indexId:indexInstance.indexId]"
title="Search this index">Search this index using the web
UI.</g:link> </br>
<g:link controller="search"
action="help"
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs