[Zope-Checkins] CVS: Zope2 - ZCatalog.py:1.7

Michel Pelletier michel@digicool.com
Thu, 26 Apr 2001 13:55:08 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/Products/ZCatalog/help
In directory korak:/tmp/cvs-serv23318

Modified Files:
	ZCatalog.py 
Log Message:
fleshed out search grammer, could use more.



--- Updated File ZCatalog.py in package Zope2 --
--- ZCatalog.py	2001/04/17 23:29:26	1.6
+++ ZCatalog.py	2001/04/26 17:55:06	1.7
@@ -202,9 +202,32 @@
         Search the catalog.  Search terms can be passed in the REQUEST
         or as keyword arguments.
 
-        
-        XXX search grammar, how terms are combined, special search
-        terms, format of returned results XXX
+        Search queries consist of a mapping of index names to search
+        parameters.  You can either pass a mapping to searchResults as
+        the variable 'REQUEST' or you can use index names and search
+        parameters as keyword arguments to the method, in other words::
+
+          searchResults(title='Elvis Exposed',
+                        author='The Great Elvonso')
+
+        is the same as::
+
+          searchResults({'title' : 'Elvis Exposed',
+                         'author : 'The Great Elvonso'})
+
+        In these examples, 'title' and 'author' are indexes.  This
+        query will return any objects that have the title *Elvis
+        Exposed* AND also are authored by *The Great Elvonso*.  Terms
+        that are passed as keys and values in a searchResults() call
+        are implicitly ANDed together. To OR two search results, call
+        searchResults() twice and add concatenate the results like this::
+
+          results = ( searchResults(title='Elvis Exposed') +
+                      searchResults(author='The Great Elvonso') )
+          
+
+        This will return all objects that have the specified title OR
+        the specified author.
 
         """