[Zope-Checkins] CVS: Zope2 - TextIndex.py:1.1.2.18
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Tue, 22 May 2001 13:02:08 -0400
Update of /cvs-repository/Zope2/lib/python/Products/PluginIndexes/TextIndex
In directory serenade:/tmp/cvs-serv19077/TextIndex
Modified Files:
Tag: ajung-dropin-registry
TextIndex.py
Log Message:
rewrote _apply_index argument handling
--- Updated File TextIndex.py in package Zope2 --
--- TextIndex.py 2001/05/21 20:23:50 1.1.2.17
+++ TextIndex.py 2001/05/22 17:02:07 1.1.2.18
@@ -103,6 +103,7 @@
from Acquisition import Implicit
from Products.PluginIndexes.common.ResultList import ResultList
from Products.PluginIndexes import PluggableIndex
+from Products.PluginIndexes.common.util import parseIndexRequest
from BTrees.IOBTree import IOBTree
from BTrees.OIBTree import OIBTree
@@ -509,33 +510,27 @@
all data fields used.
"""
+ record = parseIndexRequest(request,self.id)
- if request.has_key(self.id):
- keys = request[self.id]
- else:
- return None
-
# Changed for 2.4
# We use the default operator that can me managed via the ZMI
-
- query_operator = self.operators[self.useOperator]
- # 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
+ query_operator = record.get('operator',self.useOperator)
+ if not query_operator in self.operators:
+ raise exceptions.RuntimeError,"Invalid operator '%s' for a TextIndex" % query_operator
+
+ # We keep this for pre-2.4 compatibility
+ # This stinking code should go away somewhere. A global
+ # textindex_operator makes no sense when using multiple
+ # text indexes inside a catalog. An index operator should
+ # should be specified on a per-index base
if request.has_key('textindex_operator'):
- op=string.lower(str(request['textindex_operator']))
- query_operator = self.operators.get(op, query_operator)
+ query_operator = request['textindex_operator']
- if type(keys) is StringType:
- if not keys or not string.strip(keys):
- return None
- keys = [keys]
-
r = None
-
- for key in keys:
+ for key in record.keys:
key = string.strip(key)
if not key:
continue