lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven A Rowe" <sar...@syr.edu>
Subject RE: lucene query parser syntax "escape ="
Date Mon, 21 Jul 2008 20:02:47 GMT
Hi cw,

Which analyzer are you using?  For queries like 'location=-1' you might try WhitespaceAnalyzer,
since it won't throw out the '=', like StandardAnalyzer will.

See <http://lucene.apache.org/java/docs/queryparsersyntax.html> for info about QueryParser
syntax and metacharacter escaping.

For escaping QueryParser's metacharacters (like '-'), you could use the static QueryParser.escape()
method: <http://lucene.apache.org/java/2_3_2/api/org/apache/lucene/queryParser/QueryParser.html#escape(java.lang.String)>.

Steve

On 07/20/2008 at 11:00 PM, cw wrote:
> The "-" or prohibit operator excludes documents that contain
> the term after the "-" symbol.
> 
> so how to search for "-"
> 
> --- On Sun, 7/20/08, cw <second_comet@yahoo.com> wrote:
> From: cw <second_comet@yahoo.com>
> Subject: lucene query parser syntax "escape ="
> To: general@lucene.apache.org
> Date: Sunday, July 20, 2008, 12:59 PM
> 
> i have a field that indexed called
> <summary>. i can see the field and it's data using "luke" 
> .
>  
> the content is like below:::
>  
> sadf
> <body />
> <body />
> #
> #Sun Jul 20 22:34:07 SGT 2008
> photographerContact=
> tasterContact=
> foodType=-1
> profileType=-1
> payment=-1
> location=-1
> 
>  
>  
> How to use query parser to search for this summary field content for
> "location=-1" .  from what i know i cannot use " ="  for
> query. how to escape "="  ?
>  
> i tried something like this 'location=-1'  but failed
>  
>  
> 
> 
> 
>

 


Mime
View raw message