I've got some DTML Documents with properties Category and Author, and I'm trying to build a search interface for ZCatalog. What I want to do is build a multiple select list of the Author's names, but I want to use the Category to only display the names of People who have written columns. As an added wrinkle, the Author field present on the files corresponds to an "expanded name" sitting in a mysql DB. In other words, a column I've written might have cmuldrow in the Author property--I query the DB to return Chris Muldrow to display to searchers. Here's my code so far--it queries the DB correctly and returns a good list of names, but not filtered by Category. I tried a dtml-in tag calling NewsCatalog({'Category':'Column'}), but wherever I put it doesn't seem to work. Any ideas? Thanks! Chris Muldrow muldrow@mac.com <dtml-var standard_html_header> <h2><dtml-var title_or_id> </h2> <form action="ColumnistFind" method="get"> <select name="User" size=10 MULTIPLE> <dtml-in expr="uniqueValuesFor('User')"> <dtml-let authName=sequence-item> <option value="<dtml-var sequence-item>"><dtml-in expr="SearchAuthors(user=authName)"><dtml-var authorName></dtml-in></options> </dtml-let> </dtml-in> <input type="submit" name="Search" value="Submit query"> </select> </form> <dtml-var standard_html_footer>
Setting variables in the REQUEST is bad but always works reliably. These can be set in the form that posts to the search (see Zope.org) or as a last resort do: <dtml-call "REQUEST.set('Column', 'Category')"> <dtml-in NewsCatalog> -- Andy McKay. ----- Original Message ----- From: "Chris Muldrow" <muldrow@mac.com> To: <zope@zope.org> Sent: Thursday, February 15, 2001 11:24 AM Subject: [Zope] Searching ZCatalog on multiple properties
I've got some DTML Documents with properties Category and Author, and I'm trying to build a search interface for ZCatalog. What I want to do is build a multiple select list of the Author's names, but I want to use the Category to only display the names of People who have written columns. As an added wrinkle, the Author field present on the files corresponds to an "expanded name" sitting in a mysql DB. In other words, a column I've written might have cmuldrow in the Author property--I query the DB to return Chris Muldrow to display to searchers.
Here's my code so far--it queries the DB correctly and returns a good list of names, but not filtered by Category. I tried a dtml-in tag calling NewsCatalog({'Category':'Column'}), but wherever I put it doesn't seem to work. Any ideas? Thanks! Chris Muldrow muldrow@mac.com
<dtml-var standard_html_header> <h2><dtml-var title_or_id> </h2>
<form action="ColumnistFind" method="get"> <select name="User" size=10 MULTIPLE>
<dtml-in expr="uniqueValuesFor('User')"> <dtml-let authName=sequence-item>
<option value="<dtml-var sequence-item>"><dtml-in expr="SearchAuthors(user=authName)"><dtml-var authorName></dtml-in></options>
</dtml-let> </dtml-in>
<input type="submit" name="Search" value="Submit query"> </select> </form>
<dtml-var standard_html_footer>
_______________________________________________ Zope maillist - Zope@zope.org 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 )
I see what you're getting at, but I don't think I was specific enough in my question. What I want to do is limit the names shown to the user before they actually make a search. Right now, the uniqueValuesFor('User') queries all of the stories in the catalog and returns a Select list of all of the Users who have written stories. I want to limit that Select list rather than only limiting the search results. on 2/15/01 2:39 PM, Andy McKay at andym@ActiveState.com wrote:
Setting variables in the REQUEST is bad but always works reliably. These can be set in the form that posts to the search (see Zope.org) or as a last resort do:
<dtml-call "REQUEST.set('Column', 'Category')"> <dtml-in NewsCatalog>
-- Andy McKay.
Ah sorry, yes uniqueValuesFor just returns the index straight from ZCatalog without any filtering, no matter you put, its not going to filter. Either change the behaviour of ZCatalog or do a much more expensive query that filters the results. -- Andy McKay. ----- Original Message ----- From: "Chris Muldrow" <muldrow@mac.com> To: "Andy McKay" <andym@activestate.com>; <zope@zope.org> Sent: Thursday, February 15, 2001 11:50 AM Subject: Re: [Zope] Searching ZCatalog on multiple properties
I see what you're getting at, but I don't think I was specific enough in my question. What I want to do is limit the names shown to the user before they actually make a search. Right now, the uniqueValuesFor('User') queries all of the stories in the catalog and returns a Select list of all of the Users who have written stories. I want to limit that Select list rather than only limiting the search results.
on 2/15/01 2:39 PM, Andy McKay at andym@ActiveState.com wrote:
Setting variables in the REQUEST is bad but always works reliably. These can be set in the form that posts to the search (see Zope.org) or as a last resort do:
<dtml-call "REQUEST.set('Column', 'Category')"> <dtml-in NewsCatalog>
-- Andy McKay.
_______________________________________________ Zope maillist - Zope@zope.org 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 )
participants (2)
-
Andy McKay -
Chris Muldrow