development, programming, python, search

Pylucene- Part II: Searching index

In the last post, we discussed how to create an index over a directory. Now, let’s search our index. from lucene import \             QueryParser, IndexSearcher, IndexReader, StandardAnalyzer, \         TermPositionVector, SimpleFSDirectory, File, MoreLikeThis, \             VERSION, initVM, Version import sys FIELD_CONTENTS = “contents” FIELD_PATH = “path” QUERY_STRING = “lucene and restored” STORE_DIR = “/home/kanaujia/lucene_index” […]

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