Hi Ranjit,
I suspect the problem is not QueryParser, since the <TERM> definition includes
the '#' character (from
<http://svn.apache.org/viewvc/lucene/java/tags/lucene_3_0_3/src/java/org/apache/lucene/queryParser/QueryParser.jj?view=markup#l1136>):
| <#_TERM_START_CHAR: ( ~[ " ", "\t", "\n", "\r", "\u3000", "+", "-",
"!", "(", ")", ":", "^", "[", "]", "\"",
"{", "}", "~", "*", "?", "\\" ]
| <_ESCAPED_CHAR> ) >
| <#_TERM_CHAR: ( <_TERM_START_CHAR> | <_ESCAPED_CHAR> | "-" | "+" ) >
...
| <TERM: <_TERM_START_CHAR> (<_TERM_CHAR>)* >
Are you sure that your custom JFlex Analyzer is not being given 'C#' and then
stripping off the '#'?
You could work around this issue by pre-processing your query (and your
documents) to replace C# with csharp or something like it that would not be
broken up.
Steve
> -----Original Message-----
> From: Ranjit Kumar [mailto:[email protected]]
> Sent: Tuesday, April 26, 2011 9:55 AM
> To: [email protected]; [email protected]
> Subject: lucene 3.0.3 | QueryParser | MultiFieldQueryParser
>
> Hi,
>
> I have created my own custom analyzer and uses jFlex to made search for
> c#, .net, c++ etc.
>
> While I am trying to search c#, .net, c++ QueryParser parse .net to .net
> and C++ to C++. So it works fine. But in case of C# QueryParser parse it
> to C which makes trouble for me.
>
> Also tried to use MultiFieldQueryParser but it also do the same.
>
> Any help or suggestion will be appreciated!!!
>
>
> Thanks & Regards,
> Ranjit Kumar
>
> =========================================================================
> ========================== Private, Confidential and Privileged. This e-
> mail and any files and attachments transmitted with it are confidential
> and/or privileged. They are intended solely for the use of the intended
> recipient. The content of this e-mail and any file or attachment
> transmitted with it may have been changed or altered without the consent
> of the author. If you are not the intended recipient, please note that
> any review, dissemination, disclosure, alteration, printing, circulation
> or Transmission of this e-mail and/or any file or attachment transmitted
> with it, is prohibited and may be unlawful. If you have received this e-
> mail or any file or attachment transmitted with it in error please notify
> OTS Solutions at [email protected]
> =========================================================================
> ==========================