You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Michael Paine <mi...@justanswer.com> on 2007/04/04 10:54:28 UTC

QueryParser.Parse bug

I switched to using:
 
                Dim aQParser As QueryParser = New QueryParser("Body", New
Lucene.Net.Analysis.Standard.StandardAnalyzer())
                aQParser.SetDefaultOperator(QueryParser.Operator.AND)

                Dim aQuery As Query = aQParser.Parse(BodyQuery)
                bInnerQuery.Add(aQuery, BooleanClause.Occur.SHOULD)
 
..and when I search for:
 
m?croscope
m??roscope
 
the correct "microscope" word is found; but, when I search for:
 
?icroscope
 
System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> Lucene.Net.QueryParsers.ParseException: Lexical error at line
1, column 1.  Encountered: "?" (63), after : ""
  at Lucene.Net.QueryParsers.QueryParser.Parse(String query)

..occurs.  Any idea what I can do about this?
 
Thank you,
Michael
 
 

Re: QueryParser.Parse bug

Posted by Michael Mitiaguin <mi...@gmail.com>.
Wildcards at the beginning of a term are prohibited using QueryParser
( ? is kind of * ), but
 WildcardQuery may use leading wildcards (at the expense of performance).
Have a look at TestQuestionmark in TestWildcard.cs


On 4/4/07, Michael Paine <mi...@justanswer.com> wrote:
> I switched to using:
>
>                 Dim aQParser As QueryParser = New QueryParser("Body", New
> Lucene.Net.Analysis.Standard.StandardAnalyzer())
>                 aQParser.SetDefaultOperator(QueryParser.Operator.AND)
>
>                 Dim aQuery As Query = aQParser.Parse(BodyQuery)
>                 bInnerQuery.Add(aQuery, BooleanClause.Occur.SHOULD)
>
> ..and when I search for:
>
> m?croscope
> m??roscope
>
> the correct "microscope" word is found; but, when I search for:
>
> ?icroscope
>
> System.Web.Services.Protocols.SoapException: Server was unable to process
> request. ---> Lucene.Net.QueryParsers.ParseException: Lexical error at line
> 1, column 1.  Encountered: "?" (63), after : ""
>   at Lucene.Net.QueryParsers.QueryParser.Parse(String query)
>
> ..occurs.  Any idea what I can do about this?
>
> Thank you,
> Michael
>
>
>