Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: General

lucene query parser syntax "escape ="

 

 

Lucene general RSS feed   Index | Next | Previous | View Threaded


second_comet at yahoo

Jul 20, 2008, 9:59 AM

Post #1 of 4 (467 views)
Permalink
lucene query parser syntax "escape ="

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
 
 


second_comet at yahoo

Jul 20, 2008, 8:00 PM

Post #2 of 4 (451 views)
Permalink
Re: lucene query parser syntax "escape =" [In reply to]

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[at]yahoo.com> wrote:
From: cw <second_comet[at]yahoo.com>
Subject: lucene query parser syntax "escape ="
To: general[at]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
 
 


sarowe at syr

Jul 21, 2008, 1:02 PM

Post #3 of 4 (438 views)
Permalink
RE: lucene query parser syntax "escape =" [In reply to]

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[at]yahoo.com> wrote:
> From: cw <second_comet[at]yahoo.com>
> Subject: lucene query parser syntax "escape ="
> To: general[at]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
>  
>  
>
>
>
>


sarowe at syr

Jul 21, 2008, 1:08 PM

Post #4 of 4 (434 views)
Permalink
RE: lucene query parser syntax "escape =" [In reply to]

Hi Tom,

On 07/21/2008 at 4:07 PM, Aigner, Thomas wrote:
> Please remove my email from the general lucene group

In the email headers for messages you receive from Lucene lists, there is a List-Unsubscribe: field. Here's the one in this message, and in yours:

List-Unsubscribe: <mailto:general-unsubscribe[at]lucene.apache.org>

Does that not work for you?

Steve

Lucene general RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.