development, programming, python, search

Pylucene- Part III: Hightlighting in Search

The search result can be customized to highlight the phrases that contain the requested keyword. The following code uses “Highlighter” class from Pylucene. We emit result in HTML formatted syntax. from lucene import \             QueryParser, IndexSearcher, IndexReader, StandardAnalyzer, \         TermPositionVector, SimpleFSDirectory, File, SimpleSpanFragmenter, Highlighter, \     QueryScorer, StringReader, SimpleHTMLFormatter, \             VERSION, initVM, […]

Read more
programming, python, search

Pylucene- Part I: Creating index

How to write a simple index generator with pylucene 1 import lucene 2 3 if __name__ == ‘__main__’: 4 INDEX_DIR = “/home/kanaujia/lucene_index” 5 6 # Initialize lucene and JVM 7 lucene.initVM() 8 9 print “lucene version is:”, lucene.VERSION 10 11 # Get the analyzer 12 analyzer = lucene.StandardAnalyzer(lucene.Version.LUCENE_CURRENT) 13 14 # Get index storage 15 […]

Read more
development, linux

Pylucene: Installation on Ubuntu

If you want to install pylucene automatically, try Synaptic package manager or apt-get. This installation gives you Pylucene2.3. This is old. If you wish to get the latest pylucene 3.6 or higher, please look for manual installation discussed in this post. Automatic installation (pylucene 2.3) Install everything mentioned here sudo apt-get install pylucene sudo apt-get […]

Read more