Commit 6607df2b authored by Andreas Jung's avatar Andreas Jung

added prelim. converter for old-style indexes to pluggable indexes

(without converting their contents...needs reindexing)
parent f5fac610
......@@ -780,6 +780,40 @@ class ZCatalog(Folder, Persistent, Implicit):
ct=time.clock()-ct
return 'Finished conversion in %s seconds (%s cpu)' % (tt, ct)
def manage_convertIndex(self, ids, REQUEST=None, RESPONSE=None, URL1=None):
"""convert old-style indexes to new-style indexes"""
from Products.PluginIndexes.KeywordIndex import KeywordIndex
from Products.PluginIndexes.FieldIndex import FieldIndex
from Products.PluginIndexes.TextIndex import TextIndex
from Acquisition import aq_base
import copy
converted = []
for id in ids:
idx = self.Indexes[id]
iface = getattr(idx,'__implements__',None)
if iface is None:
mt = idx.meta_type
converted.append(id)
self.delIndex(id)
if mt in ('Field Index','Keyword Index'):
self.addIndex(id,mt.replace(' ',''))
elif mt == 'Text Index':
# TODO: Lexicon handling to be added
self.addIndex(id,'TextIndex')
if converted:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Indexes%20converted')
else:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=No%20indexes%20found%20to%20be%20converted')
#
# Indexing methods
#
......
......@@ -142,6 +142,9 @@ function toggleSelect() {
</td>
</tr>
<dtml-call "REQUEST.set('oldidx',0)">
<dtml-in objectItems sort_expr="skey" reverse_expr="rkey">
<dtml-if sequence-odd>
<tr class="row-normal">
......@@ -156,16 +159,6 @@ function toggleSelect() {
<a href="&dtml.url_quote-sequence-key;/manage_workspace">
&dtml-sequence-key; <dtml-if title>(&dtml-title;)</dtml-if>
</a>
<dtml-if locked_in_version>
<dtml-if modified_in_version>
<img src="&dtml-BASEPATH1;/p_/locked"
alt="This item has been modified in this version" />
<dtml-else>
<img src="&dtml-BASEPATH1;/p_/lockedo"
alt="This item has been modified in another version" />
(<em>&dtml-locked_in_version;</em>)
</dtml-if>
</dtml-if>
</div>
</td>
......@@ -177,6 +170,7 @@ function toggleSelect() {
<dtml-if "_.string.find(_.str(_.getattr(this(),'__implements__','old')),'PluggableIndexInterface')>-1">
<dtml-var meta_type>
<dtml-else>
<dtml-call "REQUEST.set('oldidx',1)">
(pre-2.4 index)
<dtml-var meta_type>
</dtml-if>
......@@ -210,8 +204,9 @@ function toggleSelect() {
<input class="form-element" type="submit" name="manage_delIndex:method" value="Remove index">
<input class="form-element" type="submit" name="manage_reindexIndex:method" value="Reindex">
<input class="form-element" type="submit" name="manage_clearIndex:method" value="Clear index">
<input class="form-element" type="submit" name="manage_convertIndex:method" value="Convert index">
<dtml-if oldidx>
<input class="form-element" type="submit" name="manage_convertIndex:method" value="Convert index">
</dtml-if>
<script type="text/javascript">
<!--
if (document.forms[0]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment