Searching index with special chars
Hi,
I am indexing the data with option "Field.Index.NOT_ANALYZED" so that I can fetch it later.
But If i search the index data with the special chars then expected result wont come up. I am escaping the search string as well :(
-- Code Snapshot --
Code:
doc.add(new Field("id", "a+b-c", Field.Store.YES,Field.Index.NOT_ANALYZED));
Code:
searcher = new IndexSearcher(IdxPath);
QueryParser queryParser = new QueryParser("id",
new StandardAnalyzer());
String escapedString = QueryParser.escape(searchStr);
System.out.println(escapedString);
Query query = queryParser.parse(escapedString);
System.out.println(query.toString());
Hits hits = searcher.search(query);
---
query.toString() shows the "b c" (Without the Quotes) and this is surprising for me..
Any help/suggestion will be appreciated.
--
Noor