You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by DM...@lbl.gov on 2004/01/27 22:00:11 UTC
QueryParser and escaped characters
I'm constructing a query using queryparser as follows:
Query query = QueryParser.parse("ariadne\-1",
"default", new
StandardAnalyzer());
when I print out query.toString(), i get:
default:"ariadne 1"
I'm not sure why my escape of "-" is not working?
--David Goodstein
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: QueryParser and escaped characters
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Your escape character *is* working to pass it through the parser into
the analyzer.
It is the analyzer that is splitting at the dash. Phrases get analyzed
too.
Erik
p.s. I wish I had a nickel for every Lucene issue that boils down to
QueryParser or Analyzer misunderstanding. :) The two together make
for some head-scratching fun, that is for sure.
On Jan 27, 2004, at 4:00 PM, DMGoodstein@lbl.gov wrote:
> I'm constructing a query using queryparser as follows:
>
> Query query = QueryParser.parse("ariadne\-1",
> "default", new
> StandardAnalyzer());
>
>
> when I print out query.toString(), i get:
>
> default:"ariadne 1"
>
> I'm not sure why my escape of "-" is not working?
>
> --David Goodstein
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: QueryParser and escaped characters
Posted by Incze Lajos <in...@mail.matav.hu>.
On Tue, Jan 27, 2004 at 01:00:11PM -0800, DMGoodstein@lbl.gov wrote:
> I'm constructing a query using queryparser as follows:
>
> Query query = QueryParser.parse("ariadne\-1",
> "default", new
> StandardAnalyzer());
>
>
> when I print out query.toString(), i get:
>
> default:"ariadne 1"
>
> I'm not sure why my escape of "-" is not working?
>
> --David Goodstein
>
It is working. Without escaping you would specify an ariadne BUT 1
query. It is the StandardAnalyzer which drops the '-'. Anyway,
if you've indexed with the StandardAnalyzer, you'll hardly find dashes
in your text.
incze
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org