[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Searching and Categorizing Content

webmaster at zope.org webmaster at zope.org
Wed Apr 28 10:11:28 EDT 2004


A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/SearchingZCatalog.stx#3-71

---------------

      Querying a ZCTextIndex with these advanced features works just
      like querying it with the original simple features.  In the HTML
      search form for DTML Documents, for example, you could enter
      "Koala AND Lion" and get all documents about Koalas and Lions.
      Querying a ZCTextIndex from Python with advanced features works
      much the same; suppose you want to change your
      'relevantSectionNews' Script to not include any news items that
      contain the word "catastrophic"::

        ## Script (Python) "relevantSectionNews"
        ##
        """ Returns relevant, non-catastropic news """"
        id=context.getId()
        return context.NewsCatalog(
                 {'contentTextIdx' : id + ' -catastrophic'}
                )

        % guillaume_benoit - Mar. 4, 2004 8:40 am:
         Little error:

         """ Returns relevant, non-catastropic news """"
         ... should be ...
         """ Returns relevant, non-catastropic news """

        % Anonymous User - Apr. 28, 2004 10:11 am:
         or even better:
         """ Returns relevant, non-catastrophic news """



More information about the ZDP mailing list