Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
723d020b
Commit
723d020b
authored
May 16, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run the Query tests on the Okapi indexer as well as the cosine indexer.
parent
f3075746
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
lib/python/Products/ZCTextIndex/tests/testZCTextIndex.py
lib/python/Products/ZCTextIndex/tests/testZCTextIndex.py
+16
-6
No files found.
lib/python/Products/ZCTextIndex/tests/testZCTextIndex.py
View file @
723d020b
from
Products.ZCTextIndex.ZCTextIndex
import
ZCTextIndex
from
Products.ZCTextIndex.tests
\
import
testIndex
,
testQueryEngine
,
testQueryParser
from
Products.ZCTextIndex.Index
import
scaled_int
,
SCALE_FACTOR
,
Index
from
Products.ZCTextIndex.Index
import
scaled_int
,
SCALE_FACTOR
from
Products.ZCTextIndex.Index
import
Index
as
CosineIndex
from
Products.ZCTextIndex.OkapiIndex
import
Index
as
OkapiIndex
from
Products.ZCTextIndex.Lexicon
import
Lexicon
,
Splitter
from
Products.ZCTextIndex.Lexicon
import
CaseNormalizer
,
StopWordRemover
from
Products.ZCTextIndex.QueryParser
import
QueryParser
...
...
@@ -36,7 +38,7 @@ class IndexTests(testIndex.CosineIndexTest):
extra
.
lexicon_id
=
'lexicon'
caller
=
LexiconHolder
(
Lexicon
(
Splitter
(),
CaseNormalizer
(),
StopWordRemover
()))
self
.
zc_index
=
ZCTextIndex
(
'name'
,
extra
,
caller
,
Index
)
self
.
zc_index
=
ZCTextIndex
(
'name'
,
extra
,
caller
,
Cosine
Index
)
self
.
index
=
self
.
zc_index
.
index
self
.
lexicon
=
self
.
zc_index
.
lexicon
...
...
@@ -125,8 +127,11 @@ class IndexTests(testIndex.CosineIndexTest):
self
.
assert_
(
0
<=
score
<=
SCALE_FACTOR
)
eq
(
d
[
doc
],
score
)
class
QueryTests
(
testQueryEngine
.
TestQueryEngine
,
testQueryParser
.
TestQueryParser
):
# Subclasses of QueryTestsBase must set a class variable IndexFactory to
# the kind of index to be constructed.
class
QueryTestsBase
(
testQueryEngine
.
TestQueryEngine
,
testQueryParser
.
TestQueryParser
):
# The FauxIndex in testQueryEngine contains four documents.
# docid 1: foo, bar, ham
...
...
@@ -142,7 +147,7 @@ class QueryTests(testQueryEngine.TestQueryEngine,
extra
.
lexicon_id
=
'lexicon'
caller
=
LexiconHolder
(
Lexicon
(
Splitter
(),
CaseNormalizer
(),
StopWordRemover
()))
self
.
zc_index
=
ZCTextIndex
(
'name'
,
extra
,
caller
)
self
.
zc_index
=
ZCTextIndex
(
'name'
,
extra
,
caller
,
self
.
IndexFactory
)
self
.
p
=
self
.
parser
=
QueryParser
()
self
.
index
=
self
.
zc_index
.
index
self
.
add_docs
()
...
...
@@ -162,10 +167,15 @@ class QueryTests(testQueryEngine.TestQueryEngine,
d
[
k
]
=
v
self
.
assertEqual
(
d
.
keys
(),
dict
.
keys
())
class
CosineQueryTests
(
QueryTestsBase
):
IndexFactory
=
CosineIndex
class
OkapiQueryTests
(
QueryTestsBase
):
IndexFactory
=
OkapiIndex
def
test_suite
():
s
=
unittest
.
TestSuite
()
for
klass
in
IndexTests
,
QueryTests
:
for
klass
in
IndexTests
,
CosineQueryTests
,
Okapi
QueryTests
:
s
.
addTest
(
unittest
.
makeSuite
(
klass
))
return
s
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment