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
9e244224
Commit
9e244224
authored
May 16, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move query() and numObjects() above comment about pluggable index API.
parent
cff199de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
lib/python/Products/ZCTextIndex/ZCTextIndex.py
lib/python/Products/ZCTextIndex/ZCTextIndex.py
+16
-16
No files found.
lib/python/Products/ZCTextIndex/ZCTextIndex.py
View file @
9e244224
...
...
@@ -64,6 +64,22 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
self
.
_index_factory
=
index_factory
self
.
clear
()
def
query
(
self
,
query
,
nbest
=
10
):
"""Return pair (mapping from docids to scores, num results).
The num results is the total number of results before trimming
to the nbest results.
"""
tree
=
QueryParser
().
parseQuery
(
query
)
results
=
tree
.
executeQuery
(
self
.
index
)
chooser
=
NBest
(
nbest
)
chooser
.
addmany
(
results
.
items
())
return
chooser
.
getbest
(),
len
(
results
)
def
numObjects
(
self
):
"""Return number of object indexed"""
return
self
.
index
.
length
()
## Pluggable Index APIs ##
def
index_object
(
self
,
docid
,
obj
,
threshold
=
None
):
...
...
@@ -93,22 +109,6 @@ class ZCTextIndex(Persistent, Acquisition.Implicit, SimpleItem):
results
=
tree
.
executeQuery
(
self
.
index
)
return
results
,
(
self
.
_fieldname
,)
def
query
(
self
,
query
,
nbest
=
10
):
"""Return pair (mapping from docids to scores, num results).
The num results is the total number of results before trimming
to the nbest results.
"""
tree
=
QueryParser
().
parseQuery
(
query
)
results
=
tree
.
executeQuery
(
self
.
index
)
chooser
=
NBest
(
nbest
)
chooser
.
addmany
(
results
.
items
())
return
chooser
.
getbest
(),
len
(
results
)
def
numObjects
(
self
):
"""Return number of object indexed"""
return
self
.
index
.
length
()
def
getEntryForObject
(
self
,
documentId
,
default
=
None
):
"""Return the list of words indexed for documentId"""
try
:
...
...
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