At 15:52 28/06/99 , Michel Pelletier wrote:
* Right now, search results on multiple indexes are intersected; if you have a search term on the title and the body of a news item, only objects that have hits on both indexes are shown. This makes it practically impossible to present one search field that will present the user with objects that have the search term in one of the indexes. I would like to be able to concatenate the results from different indexes. intSet supports this operation (union).
Oh man, I knew someone would open up the Query Language can of worms.
*smirk*
Yep, your right, the catalog (like ZTables) takes only the intersection of a search. Modifying the _indexedSearch() algorithm wouldn't be too hard, it's just *how* to modify it is the tricky part. The ideal solution would be to create some sort of query language that web form could dynamicly build queries to, that way, you can design your querty rather smartly. A nifty wizard could even be built to build complex web forms that you can then tweak for usability. Brainstorm on this, and let me know what you come up with.
Hmm.. many searching interfaces that let you search on multiple fields (like Eudora 4.2) give you only the option to show objects that match any or all criteria. It would certainly solve my problem if we had this choice =). Maybe ZCatalog should accept a special argument that specifies with a normal boolean search string how to join the results of the different indexes, something like: title and (summary or body) which stands for the intersection of the search results on title and the union of the search results of summary and body. The parsing logic is already there. This would allow for quite complex web interfaces, allowing for some nice datamining on ZCatalog instances. And it will allow me to do something like: <dtml-call "REQUEST.set('title', search-string)"> <dtml-call "REQUEST.set('summary', search-string)"> <dtml-call "REQUEST.set('body', search-string)"> <dtml-call "REQUEST.set('results-join', 'title or summary or body')"> <dtml-in NewsCatalog size=20 start=query_start> .. displaying results .. </dtml-in> where results-join tells Catalog to use the union of title, summary and body. Next question: The tutorial talks about ZCatalog aware objects. How can I make a ZClass ZCatalog aware? * Indexing an instance when adding is easy, as is updating the Catalog when editing but how does the deletion part work? Only when using a python base class? * Is there a standard way of selecting the Catalog instance my newly created ZClass instance will use? Or should I just use: <dtml-if "superValues('ZCatalog')"> <dtml-if "_.len(superValues('ZCatalog')) > 1"> <td><select name="catalog"> <dtml-in "superValues('ZCatalog')"> <option value=&dtml-id;><dtml-var title_and_id> </dtml-in> </select></td> <dtml-else> <dtml-in "superValues('ZCatalog')"> <td><dtml-var title_and_id> <input type=hidden name=catalog value=&dtml-id;></td> </dtml-in> </dtml-if> </dtml-if> in the addForm? -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------