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
02e86f6b
Commit
02e86f6b
authored
Apr 11, 2001
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge fix for unecessary modification of keyword indexes to trunk.
parent
11703404
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
lib/python/SearchIndex/UnKeywordIndex.py
lib/python/SearchIndex/UnKeywordIndex.py
+14
-10
No files found.
lib/python/SearchIndex/UnKeywordIndex.py
View file @
02e86f6b
...
...
@@ -118,28 +118,32 @@ class UnKeywordIndex(UnIndex):
if
type
(
newKeywords
)
is
StringType
:
newKeywords
=
(
newKeywords
,
)
# Now comes the fun part, we need to figure out what's changed
# if anything from the previous record.
oldKeywords
=
self
.
_unindex
.
get
(
documentId
,
None
)
if
oldKeywords
is
None
:
# we've got a new document, let's not futz around.
try
:
for
kw
in
newKeywords
:
self
.
insertForwardIndexEntry
(
kw
,
documentId
)
self
.
_unindex
[
documentId
]
=
list
(
newKeywords
)
except
TypeError
:
return
0
else
:
# we have an existing entry for this document, and we need
# to figure out if any of the keywords have actually changed
if
type
(
oldKeywords
)
is
not
OOSet
:
oldKeywords
=
OOSet
(
oldKeywords
)
newKeywords
=
OOSet
(
newKeywords
)
self
.
unindex_objectKeywords
(
documentId
,
difference
(
oldKeywords
,
newKeywords
))
for
kw
in
difference
(
newKeywords
,
oldKeywords
):
self
.
insertForwardIndexEntry
(
kw
,
documentId
)
self
.
_unindex
[
documentId
]
=
list
(
newKeywords
)
fdiff
=
difference
(
oldKeywords
,
newKeywords
)
rdiff
=
difference
(
newKeywords
,
oldKeywords
)
if
fdiff
or
rdiff
:
# if we've got forward or reverse changes
self
.
_unindex
[
documentId
]
=
list
(
newKeywords
)
if
fdiff
:
self
.
unindex_objectKeywords
(
documentId
,
fdiff
)
if
rdiff
:
for
kw
in
rdiff
:
self
.
insertForwardIndexEntry
(
kw
,
documentId
)
return
1
def
unindex_objectKeywords
(
self
,
documentId
,
keywords
):
""" carefully unindex the object with integer id 'documentId'"""
...
...
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