Changeset 52847
- Timestamp:
- 05/13/08 14:09:38 (4 months ago)
- Files:
-
- tools/plush/trunk/CHANGES.txt (modified) (1 diff)
- tools/plush/trunk/README.txt (modified) (2 diffs)
- tools/plush/trunk/plush/plush.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/plush/trunk/CHANGES.txt
r51526 r52847 22 22 :Target: ? 23 23 24 New features 25 ~~~~~~~~~~~~ 26 27 * Support PyLucene JCC 2.3.1, this version requires PyLucene JCC version > 2.3.0 28 Thanks to Gregor Mirai. 24 29 25 30 tools/plush/trunk/README.txt
r51712 r52847 105 105 * Plush_ requires PyLucene_ which is easy to install using binaries. 106 106 107 Here is an example on how to install the latest PyLucene_ 2.0.0-3 (Lucene_ 108 2.0.0-453447) on ubuntu:: 109 110 cd /tmp 111 wget http://downloads.osafoundation.org/PyLucene/linux/ubuntu/PyLucene-2.0.0-3.tar.gz 112 tar xzvf PyLucene-2.0.0-3.tar.gz 113 cd PyLucene-2.0.0-3/ 114 sudo cp -r python/* /usr/lib/python2.4/site-packages/ 115 sudo cp -r gcj/* /usr/local/lib 107 XXX update with PyLucene 2.3.1 JCC version 116 108 117 109 Visit the PyLucene_ site for other pre-built binaries. … … 132 124 sudo python setup.py install 133 125 134 Thats all no .jar nor java required.135 126 136 127 Plush commands tools/plush/trunk/plush/plush.py
r51712 r52847 31 31 from cmd import Cmd 32 32 33 from PyLucene import FrenchAnalyzer 34 from PyLucene import GermanAnalyzer 35 from PyLucene import KeywordAnalyzer 36 from PyLucene import SimpleAnalyzer 37 from PyLucene import StandardAnalyzer 38 from PyLucene import StopAnalyzer 39 from PyLucene import WhitespaceAnalyzer 40 from PyLucene import QueryParser, IndexSearcher, FSDirectory 41 from PyLucene import IndexReader, Sort, JavaError 42 from PyLucene import VERSION, LUCENE_VERSION 43 from PyLucene import IndexWriter, Field, Document, RAMDirectory 33 from lucene import FrenchAnalyzer 34 from lucene import GermanAnalyzer 35 from lucene import KeywordAnalyzer 36 from lucene import SimpleAnalyzer 37 from lucene import StandardAnalyzer 38 from lucene import StopAnalyzer 39 from lucene import WhitespaceAnalyzer 40 from lucene import QueryParser, IndexSearcher, FSDirectory 41 from lucene import IndexReader, StringReader, Sort, JavaError 42 from lucene import VERSION 43 from lucene import Hit 44 from lucene import IndexWriter, Field, Document, RAMDirectory 45 46 from lucene import initVM, CLASSPATH 47 initVM(CLASSPATH) 44 48 45 49 from version import __version__ … … 66 70 encoding = 'utf-8' 67 71 return encoding 68 69 class StringReader(object):70 """Class for analyzer input."""71 def __init__(self, u_text):72 super(StringReader, self).__init__()73 self.unicodeText = unicode(u_text)74 75 def read(self, length=-1):76 """Read."""77 text = self.unicodeText78 if text is None:79 return u''80 if length == -1 or length >= len(text):81 self.unicodeText = None82 return text83 text = text[:length]84 self.unicodeText = self.unicodeText[length:]85 return text86 87 def close(self):88 """Close"""89 pass90 72 91 73 def getTreeSize(top): … … 188 170 self.store_path = store_path 189 171 self.index_reader = IndexReader.open(directory) 190 self.fields = self.getFieldNames()172 self.fields = [name for name in self.getFieldNames()] 191 173 self.fields.sort() 192 174 self._connected = True … … 350 332 351 333 intro = """Welcome to Plush %s, a Lucene interactive terminal. 352 Using PyLucene %s andLucene %s.334 Using Lucene %s. 353 335 354 336 Type: \open [INDEX_PATH] to open a lucene store 355 337 \? for help 356 \q or ^D to quit.""" % (__version__, 357 VERSION, LUCENE_VERSION) 338 \q or ^D to quit.""" % (__version__, VERSION) 358 339 plush_attr = ('limit', 'select', 'default_field', 'sort_on', 359 340 'waterline', 'analyzer', 'trunc_size') … … 737 718 count = 0 738 719 result_fields = self._getResultFieldIds() 739 for i, doc in hits: 740 doc_num = hits.id(i) 720 for hit in hits: 721 hit = Hit.cast_(hit) 722 doc = hit.getDocument() 723 doc_num = hit.getId() 741 724 if waterline and doc_num < waterline: 742 725 continue … … 745 728 break 746 729 print "* %2.2d) score: %.2f, doc_num: %s" % (count, hits.score(i), 747 hit s.id(i))730 hit.getId()) 748 731 for field in result_fields: 749 732 print ' %s: %s' % (field, truncStr(doc.get(field),
