Re: [zope] ZCatalog question
- Original Message - From: "Jonathan Salazar Santos" <[EMAIL PROTECTED]> To: Sent: Tuesday, July 08, 2008 5:17 PM Subject: [zope] ZCatalog question Hi everybody I have a method that creates a Files and DTML Documents but I need to Index those news items to a ZCatalog when they are created. Do you know if there are some dtml calls (like manage_catalogACTION) to call the action: Index, Reindex, Delete indexed objects with dtml or Python Scrips. How can I do to get indexed my new items in a zcatalog automatically? Some help will be appreciated. Regards, -- Jonathan Salazar Basic ZCatalog info can be found in the "Searching and Categorizing Content" chapter of the Zope Book (http://www.plope.com/Books/2_7Edition) Automatic object cataloging was accomplished by creating 'ZCatalog aware' object instances - i can't remember if this is a feature of ZClasses only (stay away from ZClasses) or if you can create your own product that subclasses the 'awareness' features (google is your friend). You can manually add/remove items using the methods "catalog_object" and "uncatalog_object" (Zope Book and google for more info). hth Jonathan (another one) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[zope] ZCatalog question
Hi everybody I have a method that creates a Files and DTML Documents but I need to Index those news items to a ZCatalog when they are created. Do you know if there are some dtml calls (like manage_catalogACTION) to call the action: Index, Reindex, Delete indexed objects with dtml or Python Scrips. How can I do to get indexed my new items in a zcatalog automatically? Some help will be appreciated. Regards, -- Jonathan Salazar Vista: http://jonathansalazar.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] ZCatalog question
Hi Folks, i have a ZCatalog over a bunch of items with attributes A and B. Now I want to search all elements with attribute A set to value 1 and AT THE SAME TIME with attribute B set to value 2. So a sort of AND combination with two different attributes. How to do ? Regards oliver --- "All language designers are arrogant. Goes with the territory..." (By Larry Wall) --- Oliver Pabst .-. mailto:[EMAIL PROTECTED]: : phone :+49 681 56600600 :project department : SYBCOM GmbH fax :+49 681 56600660 : : http://www.sybcom.de ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZCatalog question. boolean and wildcards.
Hannes Grund writes: > When mixing boolean operators and wildcards '*' in queries within a Textindex > the 'AND' operator is replaced by 'OR'. > Also, the possibility of constructing nested terms using brackets seems > to be not supported (contrary to the chapter 'Searching and indexing' from the Zope >book). > The setting is straightforward, several indexes (text-index, keyword-indexes) > are used indexing a about 5000 Zclasses. > Are there any patches to apply or what else can i do ? Sorry, the patch I posted yesterday was not complete. There have been too more problems: * if the wildcard expansion could not find matching words, my patch created an empty subquery. Such queries, unfortunately, can not be handled by "UnTextIndex.evaluate". The new patch, instead creates a new search term, 'no_expansion_for_'. Hopefully, this term is not indexed and thus gives the same results as the empty subquery. Of cause, this is a hack. The ZCatalog maintainer should find a better solution. * The ZCatalog, more precisely, "UnTextIndex.__getitem__" still raises an "IndexError" exception, when one searches for a term that is not indexed. The result is "no data matches your query", even for an "or" query. I had already put a patch for this error in the collector for Zope 2.2.1, but apparently, DC decided not to look at it. Please discard my patch from yesterday. You may give the new patch (appended) a try. Dieter --- lib/python/SearchIndex/:GlobbingLexicon.py Mon Aug 28 19:30:06 2000 +++ lib/python/SearchIndex/GlobbingLexicon.py Sat Oct 14 11:54:24 2000 @@ -230,10 +230,22 @@ if ( (self.multi_wc in w) or (self.single_wc in w) ): wids = self.get(w) -for wid in wids: -if words: -words.append(Or) -words.append(self._inverseLex[wid]) +#for wid in wids: +#if words: +#words.append(Or) +#words.append(self._inverseLex[wid]) + if wids: + words.append(map(self._inverseLex.get,wids)) + else: + words.append('no_expansion_for_' + w) + # We do this here, as "UnTextIndex.evaluate" + #can not handle empty subqueries + # We use as expansion some expression that + #is likely not in the catalog but + #gives some indication to the problem + #in case "ResultList" does something + #with its "src" argument. + #This is a hack, though! else: words.append(w) --- lib/python/SearchIndex/:UnTextIndex.py Fri Oct 13 23:29:00 2000 +++ lib/python/SearchIndex/UnTextIndex.py Sat Oct 14 11:57:38 2000 @@ -347,8 +347,10 @@ if len(src) == 1: src=src[0] if src[:1]=='"' and src[-1:]=='"': return self[src] -r = self._index.get(self.getLexicon(self._lexicon).get(src)[0], -None) + codes= self.getLexicon(self._lexicon).get(src) + if codes: +r = self._index.get(codes[0], None) + else: r= None # maybe do something, if len(codes) > 1 if r is None: r = {} return ResultList(r, (src,), self) @@ -490,11 +492,11 @@ except IndexError: raise QueryError, "Malformed query" t=type(left) -if t is ListType: left = evaluate(left, self) +if t is ListType: left = self.evaluate(left) elif t is StringType: left=self[left] t=type(right) -if t is ListType: right = evaluate(right, self) +if t is ListType: right = self.evaluate(right) elif t is StringType: right=self[right] return (left, right) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] ZCatalog question. boolean and wildcards.
Im running Zope 2.2.2 on Linux 2.2.13. When mixing boolean operators and wildcards '*' in queries within a Textindex the 'AND' operator is replaced by 'OR'. Also, the possibility of constructing nested terms using brackets seems to be not supported (contrary to the chapter 'Searching and indexing' from the Zope book). The setting is straightforward, several indexes (text-index, keyword-indexes) are used indexing a about 5000 Zclasses. Are there any patches to apply or what else can i do ? Thanks in advance. Hannes. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] ZCatalog Question
I have a product that has three CatalogAware Zclasses. They are indexed by the catalog correctly, but when I look at the catalog's status tab, the number of objects for each index are identical, even though the ZClasses themselves don't all have the same properties. Intuitively, this seems wrong. Or maybe my intuition is wrong. It "makes more sense" to have differing number of objects based on how many of each type of ZClass instance was indexed and what the properties of each one was. Anyone have any enlightenment (or is that Zen...) ? Jeff Sasmor [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )