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
7306464c
Commit
7306464c
authored
May 29, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compuate query_weight a right(er) way.
parent
99c6aaae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
lib/python/Products/ZCTextIndex/tests/mailtest.py
lib/python/Products/ZCTextIndex/tests/mailtest.py
+5
-1
No files found.
lib/python/Products/ZCTextIndex/tests/mailtest.py
View file @
7306464c
...
...
@@ -46,6 +46,7 @@ from Products.ZCTextIndex.Lexicon import \
Lexicon
,
CaseNormalizer
,
Splitter
,
StopWordRemover
from
Products.ZCTextIndex.ZCTextIndex
import
ZCTextIndex
from
BTrees.IOBTree
import
IOBTree
from
Products.ZCTextIndex.QueryParser
import
QueryParser
import
sys
import
mailbox
...
...
@@ -161,7 +162,10 @@ def query(rt, query_str):
print
"query:"
,
query_str
print
"# results:"
,
len
(
results
),
"of"
,
num_results
,
\
"in %.2f ms"
%
(
elapsed
*
1000
)
qw
=
idx
.
index
.
query_weight
([
query_str
])
tree
=
QueryParser
(
idx
.
lexicon
).
parseQuery
(
query_str
)
qw
=
idx
.
index
.
query_weight
(
tree
.
terms
())
for
docid
,
score
in
results
:
scaled
=
100.0
*
score
/
qw
print
"docid %7d score %6d scaled %5.2f%%"
%
(
docid
,
score
,
scaled
)
...
...
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