There are so many questions and problems and deficiencies about ZCatalog. Think for example I want to index a site on bobobase_modification_time and search for date ranges. Impossible! ZCatalog does not have ranges.
Yes it does. See the section titled "Searching Field Indexes" in the Zope Book.
Recently added textindex_operator allows to use "and", "near", "andnot", "or" operators, but it is insufficient. I can only use the operator for one index. What if I want to search for "title LIKE '%ZOPE% OR body LIKE '%python%'"? Alas! Developing special SQL-like language for ZCatalog? It is hard. What than?
You currently need to union and/or intersect the result sets manually. It *is* hard, yes. ;-)
A crazy idea sprang into my mind. What if I, the site programmer, could provide a callback function, and ZCatalog will call the function for every index? Then I can code such simple or complex search as I need. Examples:
<dtml-in "Catalog(indicies=['id', 'titile', 'time'], callback=mySearch)">
def mySearch(id, titile, time): if re.search("ZOPE", id): return 1 if re.search("python", title, re.I): return 1 if "2000/01/01" <= time <= "2000/12/31": return 1 return 0
Let the function return 1 for objects that correspond the serach criteria, 0 for failed objects, and raise StopSearch exception if it need to stop search immediatly.
THis is a pretty cool idea... except I think that it might be better to just use the callback to aggregate search results in interesting ways on a per-index basis. For instance, if you specify three indexes in a query and specify a callback, the callback can do unions or intersections on the result sets returned from each index manually...