while indexing in lucene i am creating document as follows:
Document document = new Document();
Field fileNameField = new Field("name",
name,
Field.Store.YES,Field.Index.ANALYZED);
Field filePathField = new Field("code",
code,
Field.Store.YES,Field.Index.NOT_ANALYZED);
document.add(fileNameField);
document.add(filePathField);
I am trying to do search on the name field. The name has list of countries.
This is the query parser:
queryParser = new QueryParser(Version.LUCENE_36,
"name",
new StandardAnalyzer(Version.LUCENE_36));
query = queryParser.parse(searchQuery);
When i pass the search text as "in" i expect to get matching results like india,indonesia etc... but results are empty. It is only doing exact match. When i pass india the whole word, i get the response else zero results.
What will be the possible solution to get the matching results not exact. for ex. even "dia" term should give response like india etc..