I am using Apache lucene to search for a string within a file . What kind of parsing of does lucene use. If I search for obama it doesn't return results with Presobama while it returns results for #Obama. Can anyone tell me why? I am using TextField.
StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_44);
// Code to create the index
Directory index = new RAMDirectory();
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_44, analyzer);
IndexWriter w = new IndexWriter(index, config);
addDoc(w, finalstep);
w.close();
String querystr = search;
// The \"title\" arg specifies the default field to use when no field is explicitly specified in the query
Query q = new QueryParser(Version.LUCENE_44, "title", analyzer).parse(querystr);
// Searching code
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;