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
4b9d6844
Commit
4b9d6844
authored
May 17, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out the code for unindexing a doc. OkapiIndex has very little
code left in it!
parent
d398b7ba
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
16 deletions
+7
-16
lib/python/Products/ZCTextIndex/BaseIndex.py
lib/python/Products/ZCTextIndex/BaseIndex.py
+5
-2
lib/python/Products/ZCTextIndex/CosineIndex.py
lib/python/Products/ZCTextIndex/CosineIndex.py
+0
-6
lib/python/Products/ZCTextIndex/OkapiIndex.py
lib/python/Products/ZCTextIndex/OkapiIndex.py
+2
-8
No files found.
lib/python/Products/ZCTextIndex/BaseIndex.py
View file @
4b9d6844
...
@@ -86,9 +86,12 @@ class BaseIndex(Persistent):
...
@@ -86,9 +86,12 @@ class BaseIndex(Persistent):
def
index_doc
(
self
,
docid
,
text
):
def
index_doc
(
self
,
docid
,
text
):
raise
NotImplementedError
raise
NotImplementedError
#
Subclass must override
.
#
A subclass may wish to extend or override this
.
def
unindex_doc
(
self
,
docid
):
def
unindex_doc
(
self
,
docid
):
raise
NotImplementedError
for
wid
in
self
.
get_words
(
docid
):
self
.
_del_wordinfo
(
wid
,
docid
)
del
self
.
_docwords
[
docid
]
del
self
.
_docweight
[
docid
]
def
search
(
self
,
term
):
def
search
(
self
,
term
):
wids
=
self
.
_lexicon
.
termToWordIds
(
term
)
wids
=
self
.
_lexicon
.
termToWordIds
(
term
)
...
...
lib/python/Products/ZCTextIndex/CosineIndex.py
View file @
4b9d6844
...
@@ -81,12 +81,6 @@ class CosineIndex(BaseIndex):
...
@@ -81,12 +81,6 @@ class CosineIndex(BaseIndex):
self
.
_add_undoinfo
(
docid
,
wids
)
self
.
_add_undoinfo
(
docid
,
wids
)
return
len
(
wids
)
return
len
(
wids
)
def
unindex_doc
(
self
,
docid
):
for
wid
in
self
.
get_words
(
docid
):
self
.
_del_wordinfo
(
wid
,
docid
)
del
self
.
_docwords
[
docid
]
del
self
.
_docweight
[
docid
]
def
_search_wids
(
self
,
wids
):
def
_search_wids
(
self
,
wids
):
if
not
wids
:
if
not
wids
:
return
[]
return
[]
...
...
lib/python/Products/ZCTextIndex/OkapiIndex.py
View file @
4b9d6844
...
@@ -72,14 +72,8 @@ class OkapiIndex(BaseIndex):
...
@@ -72,14 +72,8 @@ class OkapiIndex(BaseIndex):
return
len
(
wids
)
return
len
(
wids
)
def
unindex_doc
(
self
,
docid
):
def
unindex_doc
(
self
,
docid
):
for
wid
in
WidCode
.
decode
(
self
.
_docwords
[
docid
]):
self
.
_totaldoclen
-=
self
.
_docweight
[
docid
]
self
.
_del_wordinfo
(
wid
,
docid
)
BaseIndex
.
unindex_doc
(
self
,
docid
)
del
self
.
_docwords
[
docid
]
count
=
self
.
_docweight
[
docid
]
del
self
.
_docweight
[
docid
]
self
.
_totaldoclen
-=
count
# The workhorse. Return a list of (IIBucket, weight) pairs, one pair
# The workhorse. Return a list of (IIBucket, weight) pairs, one pair
# for each wid t in wids. The IIBucket, times the weight, maps D to
# for each wid t in wids. The IIBucket, times the weight, maps D to
...
...
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