[Zope-dev] ZCTextIndex and ZCatalog conundrum
Andreas Jung
Andreas Jung <andreas@andreas-jung.com>
Wed, 30 Apr 2003 19:40:47 +0200
First, you can not use the sort_on parameter since TextIndexes do not
provide
the necessary keyForDocument() method. This method does not make sense
for Textindexes because it would return the content instead of the ranking
which is bound to the query and its resultset.
I think the only way is to call the indexes directly and munge the results
from both
indexes. ZCTextIndex has a query() that returns a mapping docid -> score.
With these informations it should not be too hard to solve your problem.
-aj
--On Dienstag, 29. April 2003 14:19 Uhr +0100 Chris Withers
<chrisw@nipltd.com> wrote:
> Hi,
>
> Say I have a ZCatalog with a ZCTextIndex called 'SearchableText' and a
> DateIndex called dateofpublication.
>
> I do a search like:
>
> results = MyCatalog(SearchableText = search_expression,
> dateofpublication = search_expression2)
>
> How would I get those results sorted by the relevence returned by the
> ZCTextIndex?
>
> cheers,
>
> Chris
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )