-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.txt
More file actions
317 lines (221 loc) · 8.22 KB
/
README.txt
File metadata and controls
317 lines (221 loc) · 8.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
=====
Plush
=====
:author: Benoit Delbosc
:address: bdelbosc _at_ nuxeo.com
:version: Plush/0.3.0
:revision: $Id: README.txt 51527 2007-04-12 08:34:52Z bdelbosc $
:Copyright: (C) Copyright 2007 Nuxeo SAS (http://nuxeo.com).
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
:abstract: This document describes the usage of the Plush_. It is a is a
simple interactive command line shell to inspect a Lucene_ indexes.
.. sectnum:: :depth: 1
.. contents:: Table of Contents
Introducing Plush
=================
What is Plush ?
---------------
Plush_ is PyLUcene SHell to play with a Lucene_ indexes interactively.
Main features:
* View store information.
* View indexes definition.
* Search using the Lucene_ `Query Parser Syntax`_.
* Sort result list.
* Browse by document number.
* Top term occurences for a field, matching a regex.
* Support PyLucene_ 1.9.1, 2.0.0 and 2.1.0
* Interactive shell emacs like command history and editing features.
* Command line tool and thus scriptable.
* Easy installation, no java required.
* Can load NXLucene_ analyzers.
* Plush is free software distributed under the `GNU GPL`_.
* Plush is written in python and can be easily customized.
Why using Plush_ instead of Luke_ ?
* Lucene_ indexes are on a remote server.
* You are using PyLucene_ no java available on the server.
* No X server available.
* You want to sort the result list.
* You want to have an idea of the search response time.
* You need to run command line scripts.
For other cases have a look to the great Luke_ tool.
Where to find Plush ?
=====================
Get the latest package from python `Cheese Shop`_.
Or use the bleeding edge ::
svn co http://svn.nuxeo.org/pub/tools/plush/trunk plush
Installation
============
* You need python 2.4 (2.3 not tested) with the readline support
(--enable-readline)
* Plush_ requires PyLucene_ which is easy to install using binaries.
Here is an example on how to install the latest PyLucene_ 2.0.0-3 (Lucene_
2.0.0-453447) on ubuntu::
cd /tmp
wget http://downloads.osafoundation.org/PyLucene/linux/ubuntu/PyLucene-2.0.0-3.tar.gz
tar xzvf PyLucene-2.0.0-3.tar.gz
cd PyLucene-2.0.0-3/
sudo cp -r python/* /usr/lib/python2.4/site-packages/
sudo cp -r gcj/* /usr/local/lib
Visit the PyLucene_ site for other pre-built binaries.
* Plush_ is a pure python package that you can get from the Python `Cheese
Shop`_ ::
tar xzvf plush-X.Y.Z.tar.gz
cd plush
Install plush either with::
sudo make install
or using the pythonic way::
python setup.py build
sudo python setup.py install
Thats all no .jar nor java required.
Plush commands
==============
Plush_ commands begin with a backslash other inputs are traited as Lucene_ query.
::
plush > \help
Documented commands (type \help <topic>):
========================================
close describe_indexes di exit history open quit term v
d describe_store echo help nuxset q set unset view
Examples
--------
::
$ plush
plush
Welcome to Plush 0.1.0, a Lucene interactive terminal.
Using PyLucene 2.0.0-3 and Lucene 2.0.0-453447.
Type: \open [INDEX_PATH] to open a lucene store
\? for help
\q or ^D to quit.
plush> \open tmp/PyLucene-2.0.0-3/samples/index
Opening store: /home/ben/tmp/PyLucene-2.0.0-3/samples/index
plush> \d
Directory info
--------------
* Directory path : /home/ben/tmp/PyLucene-2.0.0-3/samples/index
* Directory current version : 1168939081493
* Number of docs : 578 (max doc num: 580)
* Number of fields : 3
* Index last modified : 2007-01-30T11:04:46
* Index status : unlocked
* Has deletions : YES
* Directory implementation : org.apache.lucene.store.FSDirectory
plush> \di
Index info
----------
Found 3 fields for doc #579:
* contents Stored Indexed Tokenized
* name Stored Indexed
* path Stored Indexed
plush> foo -bar
Searching: foo -bar
------------------------------------
Default search index: contents
Simple analyzer tokens: foo, bar
Found 3 matching document(s) in 0.002s
* 00) score: 0.56, doc_num: 218
name: migrating-from-nuxmetadirectories.txt
path: /home...migrating-from-nuxmetadirectories.txt
* 01) score: 0.40, doc_num: 246
name: creating-new-content-types.txt
path: /home...creating-new-content-types.txt
* 02) score: 0.16, doc_num: 184
name: guidelines-user_interface.txt
path: /home...guidelines-user_interface.txt
Found 3 matching document(s) in 0.002s
plush> \v 184
Found 3 fields for doc #184
contents S I T : <snip>file content</snip>
name S I : guidelines-user_interface.txt
path S I : /home...guidelines-user_interface.txt
plush> \v 184 ^name
Found 3 fields for doc #184
name S I : guidelines-user_interface.txt
plush> \set
limit = 5
select = name path
default_field = contents
sort_on =
waterline =
analyzer = Simple
plush> \set sort_on contents
It is not possible to sort on a tokenized field
plush> \term contents
Top 5 term occurences for field 'contents' matching '*'.
occurences term
---------- ----
455 http
455 information
452 more
446 directory
434 copy
---------- ----
plush> \set limit 7
limit key setted.
plush> \term name \.txt$
Top 7 term occurences for field 'name' matching '\.txt$'.
occurences term
---------- ----
449 README.txt
13 DEPENDENCIES.txt
13 refresh.txt
6 TODO.txt
5 INSTALL.txt
5 LICENSE.txt
3 COPYING.txt
---------- ----
plush> ^D
Bye
The command history is saved in the ~/.plush_history file.
Using NXLucene analyzers
------------------------
You can use the NXLucene_ analyzers by setting an environnement variable
``NXLUCENE_HOME`` that point to the path where the ``analyzers`` python
module can be loaded.
::
$ export NXLUCENE_HOME=/usr/local/nxlucene/src/nxlucene
$ plush
NXLucene analyzers Loaded.
...
plush> \set analyzer french
Error: Invalid analyzer.
Possible values are: nxfrench, nxsort, Whitespace, Keyword, nxstandard, German, Stop, French, Standard, Simple, nxurl, nxkeyword
plush> \set analyzer nxfrench
plush> l'½uvre d'art
Searching: l'½uvre d'art
------------------------------------
Default search index: contents
nxfrench analyzer tokens: oeuvr, art
...
NXLucene_ analyzers are prefixed with ``nx``.
Troubles
========
* ImportError: No module named readline
You need to compile your python with readline support which requires the
readline-devel package ::
./configure --enable-readline
.. _Plush: http://public.dev.nuxeo.com/~ben/plush/
.. _PyLucene: http://pylucene.osafoundation.org/
.. _Lucene: http://lucene.apache.org/java/docs/index.html
.. _NXLucene: http://svn.nuxeo.org/trac/pub/browser/NXLucene/trunk/README.txt
.. _here: http://downloads.osafoundation.org/PyLucene/linux/debian/debian.txt
.. _`Cheese Shop`: http://www.python.org/pypi/plush
.. _`Query Parser Syntax`: http://lucene.apache.org/java/docs/queryparsersyntax.html
.. _Luke: http://www.getopt.org/luke/
.. _epydoc: http://epydoc.sourceforge.net/
.. _`GNU GPL`: http://www.gnu.org/licenses/licenses.html
.. Local Variables:
.. mode: rst
.. <!-- Local Variables: -->
.. <!-- coding: utf-8 -->
.. <!-- End: -->