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
fcf6d870
Commit
fcf6d870
authored
Jan 15, 2001
by
Christopher Petrilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge for debugging information.
parent
3579b3ab
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
211 additions
and
27 deletions
+211
-27
lib/python/Products/ZCatalog/Catalog.py
lib/python/Products/ZCatalog/Catalog.py
+13
-3
lib/python/Products/ZCatalog/CatalogBrains.py
lib/python/Products/ZCatalog/CatalogBrains.py
+11
-3
lib/python/Products/ZCatalog/ZCatalog.py
lib/python/Products/ZCatalog/ZCatalog.py
+21
-6
lib/python/Products/ZCatalog/dtml/catalogIndexes.dtml
lib/python/Products/ZCatalog/dtml/catalogIndexes.dtml
+7
-8
lib/python/Products/ZCatalog/dtml/catalogObjectInformation.dtml
...thon/Products/ZCatalog/dtml/catalogObjectInformation.dtml
+102
-0
lib/python/Products/ZCatalog/dtml/catalogView.dtml
lib/python/Products/ZCatalog/dtml/catalogView.dtml
+2
-2
lib/python/Products/ZCatalog/help/ZCatalog_Cataloged-Objects.stx
...hon/Products/ZCatalog/help/ZCatalog_Cataloged-Objects.stx
+3
-1
lib/python/SearchIndex/Lexicon.py
lib/python/SearchIndex/Lexicon.py
+6
-0
lib/python/SearchIndex/UnIndex.py
lib/python/SearchIndex/UnIndex.py
+23
-2
lib/python/SearchIndex/UnKeywordIndex.py
lib/python/SearchIndex/UnKeywordIndex.py
+1
-1
lib/python/SearchIndex/UnTextIndex.py
lib/python/SearchIndex/UnTextIndex.py
+22
-1
No files found.
lib/python/Products/ZCatalog/Catalog.py
View file @
fcf6d870
...
...
@@ -372,8 +372,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
LOG
(
'Catalog'
,
ERROR
,
(
'catalogObject was passed '
'bad index object %s.'
%
str
(
x
)))
self
.
data
=
data
return
total
def
uncatalogObject
(
self
,
uid
):
...
...
@@ -453,12 +451,24 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
return
tuple
(
record
)
def
instantiate
(
self
,
record
):
r
=
self
.
_v_result_class
(
record
[
1
])
r
.
data_record_id_
=
record
[
0
]
return
r
.
__of__
(
self
)
def
getMetadataForRID
(
self
,
rid
):
record
=
self
.
data
[
rid
]
result
=
{}
for
(
key
,
pos
)
in
self
.
schema
.
items
():
result
[
key
]
=
record
[
pos
]
return
result
def
getIndexDataForRID
(
self
,
rid
):
result
=
{}
for
(
id
,
index
)
in
self
.
indexes
.
items
():
result
[
id
]
=
index
.
__of__
(
self
).
getEntryForObject
(
rid
,
""
)
return
result
## Searching engine. You don't really have to worry about what goes
## on below here... Most of this stuff came from ZTables with tweaks.
...
...
lib/python/Products/ZCatalog/CatalogBrains.py
View file @
fcf6d870
...
...
@@ -106,13 +106,21 @@ class AbstractCatalogBrain(Record.Record, Acquisition.Implicit):
except
:
return
self
.
getPath
()
def
getObject
(
self
):
def
getObject
(
self
,
REQUEST
=
None
):
"""Try to return the object for this record"""
try
:
return
self
.
aq_parent
.
restrictedTraverse
(
self
.
getPath
())
obj
=
self
.
aq_parent
.
restrictedTraverse
(
self
.
getPath
())
if
not
obj
:
if
REQUEST
is
None
:
REQUEST
=
self
.
REQUEST
obj
=
self
.
aq_parent
.
resolve_url
(
self
.
getPath
(),
REQUEST
)
return
obj
except
:
pass
def
getRID
(
self
):
"""Return the record ID for this object."""
return
self
.
data_record_id_
class
NoBrainer
:
""" This is an empty class to use when no brain is specified. """
...
...
lib/python/Products/ZCatalog/ZCatalog.py
View file @
fcf6d870
...
...
@@ -190,7 +190,7 @@ class ZCatalog(Folder, Persistent, Implicit):
'manage_catalogView'
,
'manage_catalogFind'
,
'manage_catalogSchema'
,
'manage_catalogIndexes'
,
'manage_catalogAdvanced'
,
'manage_catalogAdvanced'
,
'manage_objectInformation'
,
'manage_catalogReindex'
,
'manage_catalogFoundItems'
,
'manage_catalogClear'
,
'manage_addColumn'
,
'manage_delColumns'
,
...
...
@@ -212,7 +212,8 @@ class ZCatalog(Folder, Persistent, Implicit):
manage_catalogSchema
=
DTMLFile
(
'dtml/catalogSchema'
,
globals
())
manage_catalogIndexes
=
DTMLFile
(
'dtml/catalogIndexes'
,
globals
())
manage_catalogAdvanced
=
DTMLFile
(
'dtml/catalogAdvanced'
,
globals
())
manage_objectInformation
=
DTMLFile
(
'dtml/catalogObjectInformation'
,
globals
())
threshold
=
10000
_v_total
=
0
...
...
@@ -429,9 +430,23 @@ class ZCatalog(Folder, Persistent, Implicit):
"""
Return a cataloged object given a 'data_record_id_'
"""
try
:
obj
=
self
.
aq_parent
.
restrictedTraverse
(
self
.
getpath
(
rid
))
if
not
obj
:
if
REQUEST
is
None
:
REQUEST
=
self
.
REQUEST
return
self
.
resolve_url
(
self
.
getpath
(
rid
),
REQUEST
)
obj
=
self
.
sq_parent
.
resolve_url
(
self
.
getpath
(
rid
),
REQUEST
)
return
obj
except
:
pass
def
getMetadataForRID
(
self
,
rid
):
"""return the correct metadata for the cataloged record id"""
return
self
.
_catalog
.
getMetadataForRID
(
int
(
rid
))
def
getIndexDataForRID
(
self
,
rid
):
"""return the current index contents for the specific rid"""
return
self
.
_catalog
.
getIndexDataForRID
(
rid
)
def
schema
(
self
):
return
self
.
_catalog
.
schema
.
keys
()
...
...
lib/python/Products/ZCatalog/dtml/catalogIndexes.dtml
View file @
fcf6d870
...
...
@@ -35,10 +35,10 @@ that have one or more keywords specified in a search query.
<td width="1%" align="right" valign="top"> </td>
<td width="64%" align="left" valign="top">
<div class="list-item">Index Name</div></td>
<td width="20%" align="
righ
t" valign="top">
<td width="20%" align="
lef
t" valign="top">
<div class="list-item">Index Type</div></td>
<td width="15%" align="
righ
t" valign="top">
<div class="list-item">
Objects Indexed
</div></td>
<td width="15%" align="
lef
t" valign="top">
<div class="list-item">
Size
</div></td>
</tr>
</dtml-if>
<dtml-if name="sequence-odd"><tr class="row-normal">
...
...
@@ -49,12 +49,11 @@ that have one or more keywords specified in a search query.
</td>
<td width="60%" align="left" valign="top">
<div class="list-item">
<a href="">&dtml-id;</a></div></td>
<td width="20%" align="
righ
t" valign="top">
<a href=""
target="_index_info_&dtml-id;"
>&dtml-id;</a></div></td>
<td width="20%" align="
lef
t" valign="top">
<div class="list-item">&dtml-meta_type;</div></td>
<td width="15%" align="right" valign="top">
<div class="list-item">
<dtml-var expr="_.len(_['sequence-item'])" thousands_commas>
<td width="15%" align="left" valign="top"><div class="list-item"
><dtml-var expr="_.len(_['sequence-item'])" thousands_commas>
</div>
</td>
</tr>
...
...
lib/python/Products/ZCatalog/dtml/catalogObjectInformation.dtml
0 → 100644
View file @
fcf6d870
<dtml-var manage_page_header>
<table width="100%" borders="0" cellspacing="2" cellpadding="0">
<tr bgcolor="#000000">
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr class="location-bar">
<td colspan="2" align="left">
<div class="std-text">
Object Information <dtml-var expr="getpath(_.int(rid))">
</div>
</td>
</tr>
<tr>
<td colspan="2" align="left">
<p class="form-help">
The goal of this page is to provide basic debugging information
about what is in the Catalog on a specific object. Listed below is
all the information that the Catalog currently contains for the
above specified object. This information should match what is
currently in the instance of that object.
</td>
</tr>
</table>
<br />
<table width="100%" borders="0" cellspacing="2" cellpadding="0">
<tr class="section-bar">
<td colspan="3" align="left">
<div class="form-label">Metadata Contents</div>
</td>
</tr>
<tr>
<td colspan="3" align="left">
<p class="form-help">Metadata is the information that the Catalog
keeps inside of its internal structure so that it can answer
questions quickly. This is then returned in the "brain" that the
Catalog gives back during searches.</p><br />
</td>
</tr>
<dtml-in expr="getMetadataForRID(_.int(rid)).items()">
<dtml-if name="sequence-start">
<tr class="list-header">
<td align="left" width="5%" bgcolor="#ffffff"> </td>
<td align="left" width="25%" valign="top" class="list-item">Key</td>
<td align="left" width="70%" valign="top" class="list-item">Value</td>
</dtml-if>
<dtml-if name="sequence-odd"><tr class="row-hilite">
<dtml-else><tr></dtml-if>
<td width="32" bgcolor="#ffffff"> </td>
<td align="left" valign="top" class="form-element">
&dtml-sequence-key;
</td>
<Td align="left" valign="top" class="form-element">
&dtml-sequence-item;
</td>
</tr>
</dtml-in>
</table>
<br />
<table width="100%" borders="0" cellspacing="2" cellpadding="0">
<tr class="section-bar">
<td colspan="3" align="left">
<div class="form-label">Index Contents</div>
</td>
</tr>
<tr>
<td colspan="3" align="left">
<p class="form-help">The following table gives information that is
contained in the various indexes of the Catalog. In the case of
Keyword or Text indexes, the results are returned as a tuple, and will
be shows a '(one, two, three)', rather than in a more normal way.</p><br />
</td>
</tr>
<dtml-in expr="getIndexDataForRID(_.int(rid)).items()">
<dtml-if name="sequence-start">
<tr class="list-header">
<td align="left" width="5%" bgcolor="#ffffff"> </td>
<td align="left" width="25%" valign="top" class="list-item">Key</td>
<td align="left" width="70%" valign="top" class="list-item">Value</td>
</dtml-if>
<dtml-if name="sequence-odd"><tr class="row-hilite">
<dtml-else><tr></dtml-if>
<td width="32" bgcolor="#ffffff"> </td>
<td align="left" valign="top" class="form-element">
&dtml-sequence-key;
</td>
<td align="left" valign="top" class="form-element">
&dtml-sequence-item;
</td>
</tr>
</dtml-in>
</table>
<dtml-var manage_page_footer>
lib/python/Products/ZCatalog/dtml/catalogView.dtml
View file @
fcf6d870
...
...
@@ -40,8 +40,8 @@
<td align="left" valign="top"> </td>
<td align="left" valign="top">
<div class="form-text">
<a href="
<dtml-var
"getURL" url_quote>/manage_workspace
">&dtml-getPath;</a>
<a href="
&dtml-URL1;/manage_objectInformation?rid=&dtml-getRID;"
target="_objectinfo_&dtml-getRID;
">&dtml-getPath;</a>
</div>
</td>
<td align="left" valign="top">
...
...
lib/python/Products/ZCatalog/help/ZCatalog_Cataloged-Objects.stx
View file @
fcf6d870
...
...
@@ -6,7 +6,9 @@ ZCatalog - Cataloged Objects: Manage catalog entries
The catalog holds records which refer to Zope objects. If the
catalog currently contains records they will be listed in this
view.
view. For debugging purposes, you may click on the link to
the item in the Catalog and it will open a debugging view of
that entry in the Catalog.
Controls
...
...
lib/python/SearchIndex/Lexicon.py
View file @
fcf6d870
...
...
@@ -150,22 +150,27 @@ class Lexicon(Persistent, Implicit):
self
.
counter
=
self
.
counter
+
1
return
self
.
counter
-
1
def
get
(
self
,
key
,
default
=
None
):
""" """
return
[
self
.
_lexicon
.
get
(
key
,
default
)]
def
__getitem__
(
self
,
key
):
return
self
.
get
(
key
)
def
__len__
(
self
):
return
len
(
self
.
_lexicon
)
def
Splitter
(
self
,
astring
,
words
=
None
):
""" wrap the splitter """
if
words
is
None
:
words
=
self
.
stop_syn
return
Splitter
(
astring
,
words
)
def
grep
(
self
,
query
):
"""
regular expression search through the lexicon
...
...
@@ -180,6 +185,7 @@ class Lexicon(Persistent, Implicit):
hits
.
append
(
x
)
return
hits
def
query_hook
(
self
,
q
):
""" we don't want to modify the query cuz we're dumb """
return
q
...
...
lib/python/SearchIndex/UnIndex.py
View file @
fcf6d870
...
...
@@ -85,7 +85,8 @@
"""Simple column indices"""
__version__
=
'$Revision: 1.21 $'
[
11
:
-
2
]
__version__
=
'$Revision: 1.22 $'
[
11
:
-
2
]
from
Globals
import
Persistent
...
...
@@ -154,6 +155,7 @@ class UnIndex(Persistent, Implicit):
def
__len__
(
self
):
return
len
(
self
.
_unindex
)
def
histogram
(
self
):
"""Return a mapping which provides a histogram of the number of
elements found at each point in the index."""
...
...
@@ -165,6 +167,21 @@ class UnIndex(Persistent, Implicit):
return
histogram
def
referencedObjects
(
self
):
"""Generate a list of IDs for which we have referenced objects."""
return
self
.
_unindex
.
keys
()
def
getEntryForObject
(
self
,
documentId
,
default
=
None
):
"""Takes a document ID and returns all the information we have
on that specific object."""
if
default
is
None
:
return
self
.
_unindex
.
get
(
documentId
,
default
)
else
:
return
self
.
_unindex
.
get
(
documentId
)
def
removeForwardIndexEntry
(
self
,
entry
,
documentId
):
"""Take the entry provided and remove any reference to documentId
in its entry in the index."""
...
...
@@ -173,6 +190,8 @@ class UnIndex(Persistent, Implicit):
if
indexRow
is
not
MV
:
try
:
indexRow
.
remove
(
documentId
)
if
len
(
indexRow
)
==
0
:
del
self
.
_index
[
entry
]
except
:
LOG
(
self
.
__class__
.
__name__
,
ERROR
,
(
'unindex_object could not remove '
...
...
@@ -185,6 +204,7 @@ class UnIndex(Persistent, Implicit):
'from index %s but couldn
\
'
t. This '
'should not happen.'
%
(
repr
(
set
),
str
(
k
))))
def
insertForwardIndexEntry
(
self
,
entry
,
documentId
):
"""Take the entry provided and put it in the correct place
in the forward index.
...
...
@@ -200,6 +220,7 @@ class UnIndex(Persistent, Implicit):
indexRow
=
self
.
_index
[
entry
]
indexRow
.
insert
(
documentId
)
def
index_object
(
self
,
documentId
,
obj
,
threshold
=
None
):
""" index and object 'obj' with integer id 'documentId'"""
...
...
@@ -309,7 +330,7 @@ class UnIndex(Persistent, Implicit):
else
:
#not a range
get
=
index
.
get
for
key
in
keys
:
if
key
:
if
nonempty
(
key
)
:
anyTrue
=
1
set
=
get
(
key
)
if
set
is
not
None
:
...
...
lib/python/SearchIndex/UnKeywordIndex.py
View file @
fcf6d870
...
...
@@ -119,7 +119,7 @@ class UnKeywordIndex(UnIndex):
newKeywords
=
MV
if
type
(
newKeywords
)
is
StringType
:
newKeywords
=
(
k
eywords
,
)
newKeywords
=
(
newK
eywords
,
)
# Now comes the fun part, we need to figure out what's changed
# if anything from the previous record.
...
...
lib/python/SearchIndex/UnTextIndex.py
View file @
fcf6d870
...
...
@@ -92,7 +92,7 @@ is no longer known.
"""
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
from
Globals
import
Persistent
...
...
@@ -195,6 +195,7 @@ class UnTextIndex(Persistent, Implicit):
def
__len__
(
self
):
return
len
(
self
.
_unindex
)
def
clear
(
self
):
self
.
_index
=
IOBTree
()
self
.
_unindex
=
IOBTree
()
...
...
@@ -212,6 +213,22 @@ class UnTextIndex(Persistent, Implicit):
return
histogram
def
getEntryForObject
(
self
,
rid
,
default
=
None
):
wordMap
=
self
.
getLexicon
(
self
.
_lexicon
).
_lexicon
.
items
()
results
=
self
.
_unindex
.
get
(
rid
,
None
)
if
results
is
None
:
return
default
else
:
# Now that we've got them, let's resolve out the word
# references
resolved
=
[]
for
(
word
,
wordId
)
in
wordMap
:
if
wordId
in
results
:
resolved
.
append
(
word
)
return
tuple
(
resolved
)
def
insertForwardIndexEntry
(
self
,
entry
,
documentId
,
score
=
1
):
"""Uses the information provided to update the indexes.
...
...
@@ -256,6 +273,7 @@ class UnTextIndex(Persistent, Implicit):
self
.
_index
[
entry
]
=
(
documentId
,
score
)
return
1
def
insertReverseIndexEntry
(
self
,
entry
,
documentId
):
"""Insert the correct entry into the reverse indexes for future
unindexing."""
...
...
@@ -263,6 +281,7 @@ class UnTextIndex(Persistent, Implicit):
newEntry
.
append
(
entry
)
self
.
_unindex
[
documentId
]
=
newEntry
def
index_object
(
self
,
documentId
,
obj
,
threshold
=
None
):
""" Index an object:
...
...
@@ -325,6 +344,7 @@ class UnTextIndex(Persistent, Implicit):
## return the number of words you indexed
return
wordCount
def
unindex_object
(
self
,
i
):
""" carefully unindex document with integer id 'i' from the text
index and do not fail if it does not exist """
...
...
@@ -345,6 +365,7 @@ class UnTextIndex(Persistent, Implicit):
' document %s'
%
str
(
i
))
del
unindex
[
i
]
def
__getitem__
(
self
,
word
):
"""Return an InvertedIndex-style result "list"
"""
...
...
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