[Zope-Checkins] CVS: Zope2 - TextIndex.py:1.1.2.5
andreas@digicool.com
andreas@digicool.com
Tue, 15 May 2001 10:48:12 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/Products/PluginIndexes/TextIndex
In directory korak.digicool.com:/tmp/cvs-serv30994/TextIndex
Modified Files:
Tag: ajung-dropin-registry
TextIndex.py
Log Message:
update
--- Updated File TextIndex.py in package Zope2 --
--- TextIndex.py 2001/05/15 13:34:09 1.1.2.4
+++ TextIndex.py 2001/05/15 14:48:12 1.1.2.5
@@ -150,7 +150,11 @@
meta_type='TextIndex'
manage_options = (
- SimpleItem.manage_options
+ SimpleItem.manage_options +
+ (
+ {'label': 'Vocabulary', # TAB: Contents
+ 'action': 'manage_vocabulary',
+ 'help': ('OFSP','ObjectManager_Contents.stx')},)
)
def __init__(self, id, ignore_ex=None, call_methods=None, lexicon=None):
@@ -179,6 +183,11 @@
self.useSplitter = self.availableSplitters[0]
+ # Default text index operator (should be visible to mgmt
+ self.operators = { 'andnot':AndNot, 'and':And,
+ 'near':Near, 'or':Or }
+ self.useOperator = 'and'
+
self.clear()
if lexicon is None:
@@ -501,20 +510,14 @@
else:
return None
- operators = {
- 'andnot':AndNot,
- 'and':And,
- 'near':Near,
- 'or':Or
- }
-
- query_operator = Or
- # We default to 'or' if we aren't passed an operator in the request
- # or if we can't make sense of the passed-in operator
+ # Changed for 2.4
+ # We use the default operator that can me managed via the ZMI
+
+ query_operator = self.operators[self.useOperator]
if request.has_key('textindex_operator'):
op=string.lower(str(request['textindex_operator']))
- query_operator = operators.get(op, query_operator)
+ query_operator = self.operators.get(op, query_operator)
if type(keys) is StringType:
if not keys or not string.strip(keys):
@@ -672,11 +675,18 @@
return query[0]
+
+ def manage_vocabulary(self):
+ """ """
+ return ""
+
- def manage_setPreferences(self,splitter,REQUEST=None,RESPONSE=None,URL1=None):
+ def manage_setPreferences(self,splitter,text_operator,
+ REQUEST=None,RESPONSE=None,URL1=None):
""" preferences of TextIndex """
self.useSplitter = splitter
+ self.useOperator = text_operator
if RESPONSE:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Preferences%20saved')