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
539ea3a2
Commit
539ea3a2
authored
Apr 23, 2004
by
Casey Duncan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port performance fix for UnIndex.numObjects()
parent
92b5652c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
lib/python/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py
...Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py
+2
-1
lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
...ucts/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
+2
-0
lib/python/Products/PluginIndexes/common/UnIndex.py
lib/python/Products/PluginIndexes/common/UnIndex.py
+3
-6
No files found.
lib/python/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py
View file @
539ea3a2
...
...
@@ -12,7 +12,6 @@
##############################################################################
import
os
,
sys
,
unittest
import
ZODB
from
Products.PluginIndexes.FieldIndex.FieldIndex
import
FieldIndex
...
...
@@ -93,6 +92,7 @@ class TestCase( unittest.TestCase ):
assert
len
(
self
.
_index
)
==
0
assert
len
(
self
.
_index
.
referencedObjects
()
)
==
0
self
.
assertEqual
(
self
.
_index
.
numObjects
(),
0
)
assert
self
.
_index
.
getEntryForObject
(
1234
)
is
None
assert
(
self
.
_index
.
getEntryForObject
(
1234
,
self
.
_marker
)
...
...
@@ -116,6 +116,7 @@ class TestCase( unittest.TestCase ):
assert
len
(
self
.
_index
)
==
len
(
values
)
-
1
#'abce' is duplicate
assert
len
(
self
.
_index
.
referencedObjects
()
)
==
len
(
values
)
self
.
assertEqual
(
self
.
_index
.
numObjects
(),
len
(
values
)
-
1
)
assert
self
.
_index
.
getEntryForObject
(
1234
)
is
None
assert
(
self
.
_index
.
getEntryForObject
(
1234
,
self
.
_marker
)
...
...
lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
View file @
539ea3a2
...
...
@@ -114,6 +114,7 @@ class TestKeywordIndex( unittest.TestCase ):
def
testEmpty
(
self
):
assert
len
(
self
.
_index
)
==
0
assert
len
(
self
.
_index
.
referencedObjects
()
)
==
0
self
.
assertEqual
(
self
.
_index
.
numObjects
(),
0
)
assert
self
.
_index
.
getEntryForObject
(
1234
)
is
None
assert
(
self
.
_index
.
getEntryForObject
(
1234
,
self
.
_marker
)
...
...
@@ -141,6 +142,7 @@ class TestKeywordIndex( unittest.TestCase ):
assert
(
self
.
_index
.
getEntryForObject
(
1234
,
self
.
_marker
)
is
self
.
_marker
)
self
.
_index
.
unindex_object
(
1234
)
# nothrow
self
.
assertEqual
(
self
.
_index
.
numObjects
(),
len
(
values
)
-
1
)
for
k
,
v
in
values
:
entry
=
self
.
_index
.
getEntryForObject
(
k
)
...
...
lib/python/Products/PluginIndexes/common/UnIndex.py
View file @
539ea3a2
...
...
@@ -12,16 +12,13 @@
##############################################################################
"""Base for bi-directional indexes
$Id: UnIndex.py,v 1.2
4 2004/04/23 15:04:24
caseman Exp $"""
$Id: UnIndex.py,v 1.2
5 2004/04/23 15:47:33
caseman Exp $"""
import
sys
from
cgi
import
escape
from
logging
import
getLogger
from
types
import
StringType
,
ListType
,
IntType
,
TupleType
from
Globals
import
Persistent
from
Acquisition
import
Implicit
from
BTrees.OOBTree
import
OOBTree
,
OOSet
from
BTrees.IOBTree
import
IOBTree
from
BTrees.IIBTree
import
IITreeSet
,
IISet
,
union
,
intersection
...
...
@@ -34,7 +31,7 @@ from Products.PluginIndexes.common import safe_callable
_marker
=
[]
LOG
=
getLogger
(
'Zope.UnIndex'
)
class
UnIndex
(
Persistent
,
Implicit
,
SimpleItem
):
class
UnIndex
(
SimpleItem
):
"""Simple forward and reverse index"""
def
__init__
(
...
...
@@ -292,7 +289,7 @@ class UnIndex(Persistent, Implicit, SimpleItem):
def
numObjects
(
self
):
""" return number of indexed objects """
return
len
(
self
.
_unindex
)
return
len
(
self
)
def
unindex_object
(
self
,
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