Tag: 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, \    […]

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 […]