root/tools/plush/trunk/README.txt

Revision 52847, 7.8 kB (checked in by bdelbosc, 3 months ago)

update to work with latest PyLucene? 2.3.2, credits goes to Gregor Mirai

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