Revision: 17291
http://sourceforge.net/p/gate/code/17291
Author: valyt
Date: 2014-02-12 12:36:21 +0000 (Wed, 12 Feb 2014)
Log Message:
-----------
- support for specifying the time between batches parameter for local indexes
- fewer confirmations when deleting an index
Modified Paths:
--------------
mimir/branches/5.0/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/LocalIndexService.groovy
mimir/branches/5.0/mimir-web/grails-app/views/indexAdmin/admin.gsp
mimir/branches/5.0/mimir-web/grails-app/views/localIndex/edit.gsp
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-12 12:34:46 UTC (rev 17290)
+++ mimir/branches/5.0/mimir-cloud/grails-app/views/indexAdmin/admin.gsp
2014-02-12 12:36:21 UTC (rev 17291)
@@ -106,8 +106,7 @@
</span></td>
<td><span class="button">
<g:actionSubmit class="delete"
- title="Click to delete this index."
- onclick="return confirm('Are you sure?');" value="Delete" />
+ title="Click to delete this index." value="Delete" />
</span></td>
</g:form>
<g:if test="${indexInstance instanceof gate.mimir.web.LocalIndex &&
indexInstance.state == Index.READY}">
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-12 12:34:46 UTC (rev 17290)
+++
mimir/branches/5.0/mimir-web/grails-app/controllers/gate/mimir/web/LocalIndexController.groovy
2014-02-12 12:36:21 UTC (rev 17291)
@@ -113,7 +113,9 @@
redirect(uri:"/")
}
else {
- return [ localIndexInstance : localIndexInstance ]
+ return [ localIndexInstance : localIndexInstance,
+ timeBetweenBatches :
localIndexService.getIndex(localIndexInstance)?.timeBetweenBatches
+ ]
}
}
@@ -138,6 +140,8 @@
localIndexInstance.properties = params
if(localIndexInstance.scorer == 'null') localIndexInstance.scorer = null
if(!localIndexInstance.hasErrors() && localIndexInstance.save()) {
+ localIndexService.getIndex(localIndexInstance).setTimeBetweenBatches(
+ Integer.parseInt(params.timeBetweenBatches))
flash.message = "LocalIndex ${localIndexInstance.name} updated"
redirect(controller:"indexAdmin", action:"admin",
params:[indexId:localIndexInstance.indexId])
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-12 12:34:46 UTC (rev 17290)
+++
mimir/branches/5.0/mimir-web/grails-app/services/gate/mimir/web/LocalIndexService.groovy
2014-02-12 12:36:21 UTC (rev 17291)
@@ -98,24 +98,16 @@
index.state = Index.CLOSING
index.save()
def indexId = index.id
- Thread.start {
- try {
- indexes.remove(indexId)?.close()
- LocalIndex.withTransaction { status ->
- def theIndex = LocalIndex.get(indexId)
- theIndex.state = Index.READY
- theIndex.save()
- }
- }
- catch(IndexException e) {
- log.error("Error while closing index ${indexId}", e)
- LocalIndex.withTransaction { status ->
- def theIndex = LocalIndex.get(indexId)
- theIndex.state = Index.FAILED
- theIndex.save()
- }
- }
+ try {
+ indexes.remove(indexId)?.close()
+ index.state = Index.READY
+ index.save()
}
+ catch(IndexException e) {
+ log.error("Error while closing index ${indexId}", e)
+ index.state = Index.FAILED
+ index.save()
+ }
}
}
@@ -158,7 +150,10 @@
engine.setSubBindingsEnabled(index.subBindingsEnabled?:false)
} catch (Exception e) {
log.error("Cannot open local index at ${index?.indexDirectory}", e)
- index.state = Index.FAILED
+ LocalIndex.withTransaction {
+ index.state = Index.FAILED
+ index.save(flush:true)
+ }
return null
}
}
@@ -247,6 +242,7 @@
public void destroy() {
// close the local indexes in a civilised fashion
// (for indexes that are not in READY mode, there is no civilised way!)
+ log.info("Closing all open indexes")
LocalIndex.list().each{ LocalIndex index ->
if(index.state == Index.READY) close(index)
}
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-12 12:34:46 UTC (rev 17290)
+++ mimir/branches/5.0/mimir-web/grails-app/views/indexAdmin/admin.gsp
2014-02-12 12:36:21 UTC (rev 17291)
@@ -100,8 +100,7 @@
value="Edit" title="Click to modify this index." /> </span>
</td>
<td><span class="button"> <g:actionSubmit class="delete"
- title="Click to delete this index."
- onclick="return confirm('Are you sure?');" value="Delete" />
+ title="Click to delete this index." value="Delete" />
</span>
</td>
</g:form>
Modified: mimir/branches/5.0/mimir-web/grails-app/views/localIndex/edit.gsp
===================================================================
--- mimir/branches/5.0/mimir-web/grails-app/views/localIndex/edit.gsp
2014-02-12 12:34:46 UTC (rev 17290)
+++ mimir/branches/5.0/mimir-web/grails-app/views/localIndex/edit.gsp
2014-02-12 12:36:21 UTC (rev 17291)
@@ -92,6 +92,12 @@
</tr>
<tr class="prop ${(++i % 2) ? 'even' : 'odd'}">
+ <td valign="top" class="name"><label for="timeBetweenBatches">Time (in
milliseconds) between batches:</label></td>
+ <td valign="top" class="value"><g:textField
+ name="timeBetweenBatches" value="${timeBetweenBatches}" /></td>
+ </tr>
+
+ <tr class="prop ${(++i % 2) ? 'even' : 'odd'}">
<td valign="top" class="name"><label for="css">Custom CSS
styles:</label></td>
<td valign="top"
class="value
${hasErrors(bean:localIndexInstance,field:'css','errors')}">
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