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
7d3414ed
Commit
7d3414ed
authored
May 08, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed some string literals for emacs hilit.
Added minimal index variety.
parent
c0bdfcb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
lib/python/SearchIndex/InvertedIndex.py
lib/python/SearchIndex/InvertedIndex.py
+36
-4
No files found.
lib/python/SearchIndex/InvertedIndex.py
View file @
7d3414ed
...
...
@@ -30,7 +30,7 @@ Example usage:
print i['blah']
$Id: InvertedIndex.py,v 1.4
6 1997/04/30 21:56:12
jim Exp $'''
$Id: InvertedIndex.py,v 1.4
7 1997/05/08 19:10:43
jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...
...
@@ -82,6 +82,10 @@ $Id: InvertedIndex.py,v 1.46 1997/04/30 21:56:12 jim Exp $'''
# (540) 371-6909
#
# $Log: InvertedIndex.py,v $
# Revision 1.47 1997/05/08 19:10:43 jim
# Changed some string literals for emacs hilit.
# Added minimal index variety.
#
# Revision 1.46 1997/04/30 21:56:12 jim
# Fixed highlighting for searches where a word occurs more than once in
# the search.
...
...
@@ -237,7 +241,7 @@ $Id: InvertedIndex.py,v 1.46 1997/04/30 21:56:12 jim Exp $'''
#
#
#
__version__
=
'$Revision: 1.4
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
7
$'
[
11
:
-
2
]
import
regex
,
string
,
copy
...
...
@@ -575,7 +579,7 @@ class Index:
src
=
WordSequence
(
isrc
,
self
.
synstop
)
for
s
in
src
:
if
s
[
0
]
==
'"'
:
if
s
[
0
]
==
'
\
"
'
:
self
.
subindex
(
s
[
1
:
-
1
],
d
,
pos
)
else
:
try
:
...
...
@@ -605,7 +609,7 @@ class Index:
__traceback_info__
=
i
,
d
,
src
,
srckey
,
s
i
=
i
+
1
if
s
[
0
]
==
'"'
:
if
s
[
0
]
==
'
\
"
'
:
self
.
subindex
(
s
[
1
:
-
1
],
d
,
i
)
else
:
try
:
...
...
@@ -627,6 +631,34 @@ class Index:
addentry
(
word
,
srckey
,(
freq
,
tuple
(
positions
)))
def
minimal_index
(
self
,
isrc
,
srckey
):
'''
\
index(src, srckey)
Update the index by indexing the words in src to the key, srckey
The source object, src, will be converted to a string and the
words in the string will be used as indexes to retrieve the objects
key, srckey. For simple objects, the srckey may be the object itself,
or it may be a key into some other data structure, such as a table.
'''
src
=
WordSequence
(
isrc
,
self
.
synstop
)
d
=
{}
__traceback_info__
=
i
,
d
,
src
,
srckey
for
s
in
src
:
if
s
[
0
]
==
'"'
:
self
.
subindex
(
s
[
1
:
-
1
],
d
,
i
)
else
:
d
[
s
]
=
1
if
not
d
:
return
addentry
=
self
.
addentry
for
word
in
d
.
keys
():
addentry
(
word
,
srckey
,())
def
addentry
(
self
,
word
,
key
,
data
):
index
=
self
.
_index_object
try
:
...
...
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