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
cfe07ebe
Commit
cfe07ebe
authored
Jun 29, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undid optimization that eats up all your hardrive space and kills your
children.
parent
5a8fc050
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
11 deletions
+32
-11
lib/python/Products/ZCatalog/Catalog.py
lib/python/Products/ZCatalog/Catalog.py
+25
-11
lib/python/Products/ZCatalog/ZCatalog.py
lib/python/Products/ZCatalog/ZCatalog.py
+7
-0
No files found.
lib/python/Products/ZCatalog/Catalog.py
View file @
cfe07ebe
...
...
@@ -90,7 +90,6 @@ from SearchIndex import UnIndex, UnTextIndex, Query
import
regex
,
pdb
import
Record
from
Missing
import
MV
from
DateTime
import
DateTime
from
Lazy
import
LazyMap
,
LazyFilter
,
LazyCat
...
...
@@ -146,7 +145,6 @@ class Catalog(Persistent, Acquisition.Implicit):
self
.
data
=
BTree
.
BTree
()
# mapping of rid to meta_data
self
.
uids
=
OIBTree
.
BTree
()
# mapping of uid to rid
self
.
paths
=
IOBTree
.
BTree
()
# mapping of rid to uid
self
.
dates
=
IOBTree
.
BTree
()
# mapping of rid to date indexed
if
brains
is
not
None
:
self
.
_v_brains
=
brains
...
...
@@ -191,7 +189,7 @@ class Catalog(Persistent, Acquisition.Implicit):
def
addColumn
(
self
,
name
,
default_value
=
None
):
""" adds a row to the meta
_
data schema """
""" adds a row to the meta
data schema """
schema
=
self
.
schema
names
=
list
(
self
.
names
)
...
...
@@ -206,8 +204,6 @@ class Catalog(Persistent, Acquisition.Implicit):
schema
[
name
]
=
0
names
.
append
(
name
)
if
default_value
is
None
or
default_value
==
''
:
default_value
=
MV
...
...
@@ -225,7 +221,7 @@ class Catalog(Persistent, Acquisition.Implicit):
def
delColumn
(
self
,
name
):
""" deletes a row from the meta
_
data schema """
""" deletes a row from the meta
data schema """
names
=
list
(
self
.
names
)
_index
=
names
.
index
(
name
)
...
...
@@ -279,9 +275,15 @@ class Catalog(Persistent, Acquisition.Implicit):
# the cataloging API
def
catalogObject
(
self
,
object
,
uid
):
""" adds an object to the Catalog
"""
Adds an object to the Catalog by iteratively applying it
all indexes.
'object' is the object to be cataloged
'uid' is the unique Catalog identifier for this object
"""
data
=
self
.
data
...
...
@@ -307,11 +309,15 @@ class Catalog(Persistent, Acquisition.Implicit):
def
uncatalogObject
(
self
,
uid
):
""" Uncatalog and object from the Catalog.
and 'uid' is a unique Catalog identifier
"""
Uncatalog and object from the Catalog. and 'uid' is a unique
Catalog identifier
Note, the uid must be the same as when the object was
cataloged, otherwise it will not get removed from the catalog """
cataloged, otherwise it will not get removed from the catalog
"""
if
uid
not
in
self
.
uids
.
keys
():
'no object with uid %s'
%
uid
...
...
@@ -344,6 +350,13 @@ class Catalog(Persistent, Acquisition.Implicit):
""" return unique values for FieldIndex name """
return
self
.
indexes
[
name
].
uniqueValues
()
def
hasuid
(
self
,
uid
):
""" return the rid if catalog contains an object with uid """
if
uid
in
self
.
uids
.
keys
():
return
self
.
uids
[
uid
]
else
:
return
None
def
recordify
(
self
,
object
):
""" turns an object into a record tuple """
...
...
@@ -407,7 +420,8 @@ class Catalog(Persistent, Acquisition.Implicit):
for
k
,
intset
in
sort_index
.
items
():
__traceback_info__
=
intset
,
intset
.
__class__
intset
=
intset
.
intersection
(
rs
)
if
intset
:
append
((
k
,
LazyMap
(
self
.
__getitem__
,
intset
)))
if
intset
:
append
((
k
,
LazyMap
(
self
.
__getitem__
,
intset
)))
return
used
...
...
lib/python/Products/ZCatalog/ZCatalog.py
View file @
cfe07ebe
...
...
@@ -88,6 +88,7 @@ from Globals import HTMLFile, MessageDialog
import
Globals
from
OFS.Folder
import
Folder
from
OFS.FindSupport
import
FindSupport
from
DateTime
import
DateTime
from
SearchIndex
import
Query
import
string
,
regex
,
urlparse
,
urllib
,
os
,
sys
import
Products
...
...
@@ -96,6 +97,7 @@ from Persistence import Persistent
from
Catalog
import
Catalog
,
orify
import
pdb
,
traceback
from
SearchIndex
import
UnIndex
,
UnTextIndex
import
IOBTree
manage_addZCatalogForm
=
HTMLFile
(
'addZCatalog'
,
globals
())
...
...
@@ -170,6 +172,9 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
self
.
_catalog
.
addColumn
(
'bobobase_modification_time'
)
self
.
_catalog
.
addIndex
(
'bobobase_modification_time'
,
'FieldIndex'
)
self
.
_catalog
.
addColumn
(
'summary'
)
self
.
_catalog
.
addIndex
(
'PrincipiaSearchSource'
,
'TextIndex'
)
def
manage_catalogObject
(
self
,
REQUEST
,
urls
=
None
,
blah
=
None
):
""" index all Zope objects that 'urls' point to """
...
...
@@ -302,11 +307,13 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
def
catalog_object
(
self
,
obj
,
uid
):
""" wrapper around catalog """
self
.
_catalog
.
catalogObject
(
obj
,
uid
)
def
uncatalog_object
(
self
,
uid
):
""" wrapper around catalog """
self
.
_catalog
.
uncatalogObject
(
uid
)
...
...
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