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
3d5768f7
Commit
3d5768f7
authored
May 23, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a primitive way to show the full message.
parent
b98b6471
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
lib/python/Products/ZCTextIndex/tests/mhindex.py
lib/python/Products/ZCTextIndex/tests/mhindex.py
+30
-2
No files found.
lib/python/Products/ZCTextIndex/tests/mhindex.py
View file @
3d5768f7
...
...
@@ -231,6 +231,7 @@ class Indexer:
pass
text
=
""
top
=
0
results
=
[]
while
1
:
try
:
line
=
raw_input
(
"Query: "
)
...
...
@@ -238,6 +239,9 @@ class Indexer:
print
"
\
n
Bye."
break
line
=
line
.
strip
()
if
line
.
startswith
(
"/"
):
self
.
specialcommand
(
line
,
results
,
top
-
nbest
)
continue
if
line
:
text
=
line
top
=
0
...
...
@@ -251,7 +255,6 @@ class Indexer:
except
:
reportexc
()
text
=
""
top
=
0
continue
if
len
(
results
)
<=
top
:
if
not
n
:
...
...
@@ -259,13 +262,38 @@ class Indexer:
else
:
print
"No more hits for %r."
%
text
text
=
""
top
=
0
continue
print
"[Results %d-%d from %d"
%
(
top
+
1
,
min
(
n
,
top
+
nbest
),
n
),
print
"for query %s]"
%
repr
(
text
)
self
.
formatresults
(
text
,
results
,
maxlines
,
top
,
top
+
nbest
)
top
+=
nbest
def
specialcommand
(
self
,
line
,
results
,
first
):
assert
line
.
startswith
(
"/"
)
line
=
line
[
1
:]
if
not
line
:
n
=
first
else
:
try
:
n
=
int
(
line
)
-
1
except
:
print
"Huh?"
return
if
n
<
0
or
n
>=
len
(
results
):
print
"Out of range"
return
docid
,
score
=
results
[
n
]
path
=
self
.
docpaths
[
docid
]
i
=
path
.
rfind
(
"/"
)
assert
i
>
0
folder
=
path
[:
i
]
n
=
path
[
i
+
1
:]
cmd
=
"show +%s %s"
%
(
folder
,
n
)
if
os
.
getenv
(
"DISPLAY"
):
os
.
system
(
"xterm -e %s &"
%
cmd
)
else
:
os
.
system
(
cmd
)
def
query
(
self
,
text
,
nbest
=
NBEST
,
maxlines
=
MAXLINES
):
results
,
n
=
self
.
timequery
(
text
,
nbest
)
if
not
n
:
...
...
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