I am doing search for documents that contains the text entered by user
It works fine if the searchText don't have any special characters in it.
Below is how i create my QueryParser. :
//analyzer is an StandardAnalyzer()
QueryParser parser = new QueryParser("Text", analyzer);
parser.SetAllowLeadingWildcard(true);
return parser.Parse(string.Format("*{0}*", searchText));
I get the following error if the search text contains any special character in it :
suppose say search text is "bed ["
Cannot parse '*bed [*': Encountered "<EOF>" at line 1, column 7.
How can i make my query parser not fail if there are any special characters in search text and also i don't want to ignore the special characters.