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): ...@@ -780,6 +780,40 @@ class ZCatalog(Folder, Persistent, Implicit):
ct=time.clock()-ct ct=time.clock()-ct
return 'Finished conversion in %s seconds (%s cpu)' % (tt, 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 # Indexing methods
# #
......
...@@ -142,6 +142,9 @@ function toggleSelect() { ...@@ -142,6 +142,9 @@ function toggleSelect() {
</td> </td>
</tr> </tr>
<dtml-call "REQUEST.set('oldidx',0)">
<dtml-in objectItems sort_expr="skey" reverse_expr="rkey"> <dtml-in objectItems sort_expr="skey" reverse_expr="rkey">
<dtml-if sequence-odd> <dtml-if sequence-odd>
<tr class="row-normal"> <tr class="row-normal">
...@@ -156,16 +159,6 @@ function toggleSelect() { ...@@ -156,16 +159,6 @@ function toggleSelect() {
<a href="&dtml.url_quote-sequence-key;/manage_workspace"> <a href="&dtml.url_quote-sequence-key;/manage_workspace">
&dtml-sequence-key; <dtml-if title>(&dtml-title;)</dtml-if> &dtml-sequence-key; <dtml-if title>(&dtml-title;)</dtml-if>
</a> </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> </div>
</td> </td>
...@@ -177,6 +170,7 @@ function toggleSelect() { ...@@ -177,6 +170,7 @@ function toggleSelect() {
<dtml-if "_.string.find(_.str(_.getattr(this(),'__implements__','old')),'PluggableIndexInterface')>-1"> <dtml-if "_.string.find(_.str(_.getattr(this(),'__implements__','old')),'PluggableIndexInterface')>-1">
<dtml-var meta_type> <dtml-var meta_type>
<dtml-else> <dtml-else>
<dtml-call "REQUEST.set('oldidx',1)">
(pre-2.4 index) (pre-2.4 index)
<dtml-var meta_type> <dtml-var meta_type>
</dtml-if> </dtml-if>
...@@ -210,8 +204,9 @@ function toggleSelect() { ...@@ -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_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_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_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"> <script type="text/javascript">
<!-- <!--
if (document.forms[0]) { 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