Massimiliano della Rovere wrote:
> Suppose I have an object with the following interface:
> IArtFile
> author: TextLine...
> subject: Textline...
> location: TextLine...
> 
> I setup 3 text indices and create 3 adapters implementing
> ISearchableText to extract each field.
> 
> I want  to create a search viewlet or page with a <form> section containing
> [search field author, name & id = author]
> [search field subject, name & id = subject]
> [search field TextLine, name & id = subect]
> I thought about using a class derived from BaseForm or something like
> that to use the practical Fields(IArtFile). What is the best class to
> derive from?
> 
> Then I have somehow to instruct the ICatalog Utility to combine the
> result from the indicies, I mean
> if subject is "David" and author "Michelangelo" and location
> "Firenze", I want all the istances implementing IArtFile having these
> text lines in their attributes.
> I was thinking about converting the list returned by each
> catalog.apply function into set and then calculating the intersect
> function.
> Is there a better way to do it?

You can pass a dict {'author': u"Michelangelo", 'subject': u"David",
'location': u"Firenze"} to the catalog's apply-method and it will return
a weighted intersection. That is already implemented. See
zope.app.catalog.README.txt -- Great work by the developers, Thanks!

You should also have look at the extentcatalog in zc.catalog which is
cool for calculating inverted search queries.

BTW, for or-conjunctions of search queries have a look at the
capabilities of of ITreeSets and BTrees regarding set unions. For
weighted set unions you will need Integer-Object (Integer-Float)
structures, I guess.


Hmm, forms... I'm will have to think about this for my own app, too.
Currently I have TextIndices only, and do not need to convert user input
from unicode to an other type for ValueIndices. So I currently do not
use forms but simply process user input.

Regards,
Christian
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to