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
426e8f58
Commit
426e8f58
authored
Oct 13, 1998
by
Jeffrey Shell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added dpUniqueValues and dpHasUniqueValuesFor methods
parent
d1bf8a92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
lib/python/SearchIndex/Index.py
lib/python/SearchIndex/Index.py
+30
-2
No files found.
lib/python/SearchIndex/Index.py
View file @
426e8f58
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
__doc__
=
'''Simple column indexes
__doc__
=
'''Simple column indexes
$Id: Index.py,v 1.1
4 1998/02/25 22:38:34
jeffrey Exp $'''
$Id: Index.py,v 1.1
5 1998/10/13 21:07:17
jeffrey Exp $'''
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
from
Globals
import
Persistent
from
Globals
import
Persistent
from
BTree
import
BTree
from
BTree
import
BTree
...
@@ -45,6 +45,31 @@ class Index(Persistent):
...
@@ -45,6 +45,31 @@ class Index(Persistent):
self
.
_reindex
()
self
.
_reindex
()
def
dpHasUniqueValuesFor
(
self
,
name
):
' has unique values for column NAME '
if
name
==
self
.
id
:
return
1
else
:
return
0
def
dpUniqueValues
(
self
,
name
=
None
,
withLengths
=
0
):
"""
\
returns the unique values for name
if withLengths is true, returns a sequence of
tuples of (value, length)
"""
if
name
is
None
:
name
=
self
.
id
elif
name
!=
self
.
id
:
return
[]
if
not
withLengths
:
return
tuple
(
self
.
_index
.
keys
())
else
:
rl
=
[]
for
i
in
self
.
_index
.
keys
():
rl
.
append
((
i
,
len
(
self
.
_index
[
i
])))
return
tuple
(
rl
)
def
clear
(
self
):
def
clear
(
self
):
self
.
_index
=
BTree
()
self
.
_index
=
BTree
()
...
@@ -181,6 +206,9 @@ class Index(Persistent):
...
@@ -181,6 +206,9 @@ class Index(Persistent):
##############################################################################
##############################################################################
#
#
# $Log: Index.py,v $
# $Log: Index.py,v $
# Revision 1.15 1998/10/13 21:07:17 jeffrey
# added dpUniqueValues and dpHasUniqueValuesFor methods
#
# Revision 1.14 1998/02/25 22:38:34 jeffrey
# Revision 1.14 1998/02/25 22:38:34 jeffrey
# made the Index persistent, just as it should be
# made the Index persistent, just as it should be
#
#
...
...
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