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

webmaster at zope.org webmaster at zope.org
Sat Dec 6 07:00:10 EST 2003


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

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

      Often you will use a small list of terms with KeywordIndexes.
      In this case you may want to use the 'uniqueValuesFor' method to
      create a custom search form. For example here's a snippet of a
      Page Template that will create a multiple select box for all the
      values in the 'keywords' index::

        <select name="keywords:list" multiple>
          <option 
            tal:repeat="item python:here.uniqueValuesFor('keywords')"
            tal:content="item">
              opt value goes here
          </option>
        </select>

        % Anonymous User - Nov. 25, 2003 7:42 am:
         please refer to Products/PluginIndexes/README.txt to change the operator! the default is OR, not AND.

        % Anonymous User - Nov. 25, 2003 7:49 am:
         add
         <input type="hidden" name="keywords.operator:record" value="and">
         and change
         <select name="keywords:list" multiple>
         to
         <select name="keywords.query:list:record" multiple>

         to get as search-result only entries containing _all_ selected keywords.

        % Anonymous User - Dec. 6, 2003 7:00 am:
         what about if keyword is empty? eg <input name=keywords> and you leave it blank. It doesn' return anything
         instead of all. This is a problem.



More information about the ZDP mailing list