lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Walpole" <>
Subject Porter stemming problem
Date Fri, 22 Jun 2007 15:38:56 GMT

I am using the PorterStemAnalyzer class (attached) to provide stemming
for a Lucene index.

To stem the terms in the index we use the following...

//open an index writer in append mode
IndexWriter idxWriter = new IndexWriter(LUCENE_INDEX_PATH, new
PorterStemAnalyzer(), false);

//add the lucene document to the index

Having inspected the index using Luke, I can confirm that the terms are
being stemmed as expected. However, in order for this to work properly I
am not clear whether I should also be stemming the search terms that are

For example there is a term "relax" in the index which I guess is
stemmed from "relaxation". If the user searches on "relaxing" do I need
to stem the search term in order for it to return the result? 

At the moment I am attempting to do this as follows...

analyzer = new PorterStemAnalyzer();
parser = new QueryParser("content", analyzer);
Query query = parser.parse("keywords: relaxing");
Hits hits =;

...but this is not returning any matches.

Rob Walpole 
Devon Portal Developer


View raw message