added catalog package with a simple variation of hurry.query and a keyword index

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2555 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-04-26 17:00:28 +00:00
parent 0cfe7f951f
commit 5d022e524e

View file

@ -71,7 +71,7 @@ Now let's create some objects so that they'll be cataloged.
... Content(3, 'X', 'c'), ... Content(3, 'X', 'c'),
... Content(4, 'a', 'b', 'e'), ... Content(4, 'a', 'b', 'e'),
... Content(5, 'X', 'b', 'e', k1=('zope', 'plone')), ... Content(5, 'X', 'b', 'e', k1=('zope', 'plone')),
... Content(6, 'Y', 'Z', t1='some interesting text')] ... Content(6, 'Y', 'Z', t1='some very interesting text')]
And catalog them now. And catalog them now.
@ -189,7 +189,14 @@ Text Index Queries
>>> t1 = ('', 't1') >>> t1 = ('', 't1')
>>> displayQueryWithScores(Text(t1, 'interesting')) >>> displayQueryWithScores(Text(t1, 'interesting'))
[(6, 0.149...)] [(6, 0.149...)]
>>> displayQueryWithScores(Text(t1, 'interesting') & Eq(f1, 'Y') >>> displayQueryWithScores(Text(t1, 'interesting') & Eq(f1, 'Y'))
[(6, 1.149...)]
>>> displayQueryWithScores(Text(t1, 'interesting') | Eq(f1, 'a'))
[(1, 1.0), (2, 1.0), (4, 1.0), (6, 0.149...)]
>>> displayQueryWithScores(Text(t1, 'interesting') | Text(t1, 'text'))
[(6, 0.298...)]
>>> displayQueryWithScores(Text(t1, 'interesting') & Text(t1, 'text'))
[(6, 0.298...)]
Keyword Index Queries Keyword Index Queries