How to properly escape dashes, etc. when using snowball


(Shane Witbeck) #1

I have an edge case where I'd like to be able to return results by
searching for "activationkey" where it's within text like "XMLRPC
--activationkey=<default". I've tried escaping via backslashes
(--activationkey*), etc. but ideally I want to be able to just search for
activationkey and get results.

I'm using a QueryStringSearch and snowball analyzer under the covers. Any
suggestions on how to address this?


(Clinton Gormley) #2

On Thu, 2012-03-22 at 09:58 -0700, Shane Witbeck wrote:

I have an edge case where I'd like to be able to return results by
searching for "activationkey" where it's within text like "XMLRPC
--activationkey=<default". I've tried escaping via backslashes
(--activationkey*), etc. but ideally I want to be able to just
search for activationkey and get results.

I'm using a QueryStringSearch and snowball analyzer under the covers.

You don't need the snowball analyzer - the standard analyzer will work.
And a query-string/field/text search for 'activationkey' will work too

clint

curl -XGET 'http://127.0.0.1:9200/_analyze?pretty=1&text=XMLRPC+--activationkey%3D<default'

[Thu Mar 22 18:11:17 2012] Response:

{

"tokens" : [

{

"end_offset" : 6,

"position" : 1,

"start_offset" : 0,

"type" : "",

"token" : "xmlrpc"

},

{

"end_offset" : 22,

"position" : 2,

"start_offset" : 9,

"type" : "",

"token" : "activationkey"

},

{

"end_offset" : 31,

"position" : 3,

"start_offset" : 24,

"type" : "",

"token" : "default"

}

]

}


(system) #3