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
a83dfef0
Commit
a83dfef0
authored
Sep 17, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added normalized score
parent
07b52648
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
lib/python/Products/ZCatalog/Catalog.py
lib/python/Products/ZCatalog/Catalog.py
+12
-11
No files found.
lib/python/Products/ZCatalog/Catalog.py
View file @
a83dfef0
...
...
@@ -158,18 +158,17 @@ class Catalog(Persistent, Acquisition.Implicit):
""" Returns instances of self._v_brains, or whatever is passed
into self.useBrains.
"""
## import pdb
## pdb.set_trace()
if
type
(
index
)
is
ttype
:
score
,
key
=
index
normalized_score
,
score
,
key
=
index
r
=
self
.
_v_result_class
(
self
.
data
[
key
]).
__of__
(
self
.
aq_parent
)
r
.
data_record_score_
=
score
r
.
data_record_id_
=
key
r
.
data_record_score_
=
score
r
.
data_record_normalized_score_
=
normalized_score
else
:
r
=
self
.
_v_result_class
(
self
.
data
[
index
]).
__of__
(
self
.
aq_parent
)
r
.
data_record_id_
=
index
r
.
data_record_score__
=
1
r
.
data_record_normalized_score_
=
1
return
r
def
__setstate__
(
self
,
state
):
...
...
@@ -193,6 +192,8 @@ class Catalog(Persistent, Acquisition.Implicit):
scopy
[
'data_record_id_'
]
=
len
(
self
.
schema
.
keys
())
scopy
[
'data_record_score_'
]
=
len
(
self
.
schema
.
keys
())
+
1
scopy
[
'data_record_normalized_score_'
]
=
len
(
self
.
schema
.
keys
())
+
2
mybrains
.
__record_schema__
=
scopy
self
.
_v_brains
=
brains
...
...
@@ -285,7 +286,6 @@ class Catalog(Persistent, Acquisition.Implicit):
def
catalogObject
(
self
,
object
,
uid
,
threshold
=
None
):
"""
Adds an object to the Catalog by iteratively applying it
all indexes.
...
...
@@ -294,7 +294,6 @@ class Catalog(Persistent, Acquisition.Implicit):
'uid' is the unique Catalog identifier for this object
"""
data
=
self
.
data
if
self
.
uids
.
has_key
(
uid
):
...
...
@@ -322,7 +321,6 @@ class Catalog(Persistent, Acquisition.Implicit):
def
uncatalogObject
(
self
,
uid
):
"""
Uncatalog and object from the Catalog. and 'uid' is a unique
Catalog identifier
...
...
@@ -330,7 +328,6 @@ class Catalog(Persistent, Acquisition.Implicit):
catalogued, otherwise it will not get removed from the catalog
"""
if
uid
not
in
self
.
uids
.
keys
():
return
...
...
@@ -352,7 +349,6 @@ class Catalog(Persistent, Acquisition.Implicit):
del
self
.
paths
[
rid
]
def
clear
(
self
):
""" clear catalog """
self
.
data
=
BTree
.
BTree
()
...
...
@@ -401,6 +397,7 @@ class Catalog(Persistent, Acquisition.Implicit):
def
_indexedSearch
(
self
,
args
,
sort_index
,
append
,
used
,
IIBType
=
type
(
IIBucket
()),
intSType
=
type
(
intSet
())):
rs
=
None
data
=
self
.
data
...
...
@@ -438,7 +435,11 @@ class Catalog(Persistent, Acquisition.Implicit):
rset
.
append
((
score
,
key
))
rset
.
sort
()
rset
.
reverse
()
append
(
LazyMap
(
self
.
__getitem__
,
rset
))
max
=
float
(
rset
[
0
][
0
])
rs
=
[]
for
score
,
key
in
rset
:
rs
.
append
((
int
((
score
/
max
)
*
100
),
score
,
key
))
append
(
LazyMap
(
self
.
__getitem__
,
rs
))
elif
sort_index
is
None
and
type
(
rs
)
is
intSType
:
append
(
LazyMap
(
self
.
__getitem__
,
rs
))
...
...
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