Example of Stemming Apache Lucene - Russian language:
String querystr = "Проводнику большие";
Analyzer analyzer = new RussianAnalyzer(Version.LUCENE_40);
Directory index = new RAMDirectory();
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
IndexWriter w = new IndexWriter(index, config);
addDoc(w, "Проводник большой", "193398817");
addDoc(w, "Проводнику большому", "55320055Z");
addDoc(w, "Проводные большие", "55063554A");
addDoc(w, "Большие проводники", "9900333X");
w.close();
Query q = new QueryParser(Version.LUCENE_40, "title", analyzer).parse(querystr);
int hitsPerPage = 10;
IndexReader reader = DirectoryReader.open(index);
IndexSearcher searcher = new IndexSearcher(reader);
TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage, true);
searcher.search(q, collector);
ScoreDoc[] hits = collector.topDocs().scoreDocs;
System.out.println("Found " + hits.length + " hits.");
for (int i = 0; i < hits.length; ++i) {
int docId = hits[i].doc;
Document d = searcher.doc(docId);
System.out.println((i + 1) + ". " + d.get("isbn") + "\t" + d.get("title"));
}
reader.close();