The method you seek is QueryParser.Escape():

QueryParser queryParser = new
QueryParser(Lucene.Net.Util.Version.LUCENE_29,"Contents", analyzer);
queryParser.Parse(QueryParser.Escape("\"ri*k fac*r\"~3"));

On Thu, Nov 11, 2010 at 6:58 AM, Umer Khalid Qureshi
<[email protected]> wrote:
> Well, I am facing the same problem
> I am though using standardanalyzer as following:
>
> analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(new string[] {
> "" });
>
> and the search query i am doing is like  *"ri*k fac*r"~3*
> but when i parse it through query parser,
>
> QueryParser queryParser = new
> QueryParser(Lucene.Net.Util.Version.LUCENE_29,"Contents", analyzer);
> queryParser.Parse(*"\"ri*k fac*r\"~3"*);
>
> it replaced '*' with empty space and results as *"ri k fac r"~3*
>
> I tried following too
> queryParser.Parse(*"\"ri\\*k fac\\*r\"~3"*);
> but of no use.
>
> Can you guide us how to escape them ?
>
> P.S: when i use Whitespaceanalyzer, the parsing become just fine and results
> as i expect. but i can't use whiteSpaceAnalyzer.
>
>
>
>
>
>
>
> 2010/11/11 Pál Barnabás <[email protected]>
>
>> Hi,
>> Check the 'Escaping Special Characters' section in the query parser
>> document:
>> http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
>>
>> 2010/11/11 K a r n a <[email protected]>:
>> > How can I search when my search term contains #, /, &. $, @,
>> > ',(,),{,},[,],|,\-,+,=,*,!,~,`....etc
>> >
>> > for example If I want to search C#, Asp.net, Accounting/ Audinting,
>> > Banking & Financial...
>> > How I can prepare a search query for the above keywords
>> > ...
>> > Please let me know if anyone knows the solution...I'm doing trial and
>> > error from past 1 month....
>> > still I'm unable to find the solution.
>> >
>> >
>> > --
>> > Thanks & Regards,
>> > Karunaker Reddy V
>> >
>>
>

Reply via email to