QueryStringQuery Search with Comma


(davrob) #1

Hi,

I'm trying to make a query like this:

steel* OR (tokenizedCusAttrIdValue:29,steel*) OR

(tokenizedCusAttrIdValue:33,steel*) OR (tokenizedCusAttrIdValue:
34,steel*) OR (tokenizedCusAttrIdValue:65000088,steel*))

In QueryStringQuery, with the default operator set to AND.

It appears that the phrases like this "tokenizedCusAttrIdValue:
29,steel*" are not being picked up. The analyser is the default
analyser, will comma count as a stop word or will it count in the
query?

Best Regards,

David.


(Jan Fiedler) #2

You can take a look at what the analyzer does via the index analyze API.
This can be accessed via curl like this:

curl -XGET 'localhost:9200//_analyze?text=29,steel*'

Running this returns something like:

{
"tokens" : [ {
"token" : "29",
"start_offset" : 0,
"end_offset" : 2,
"type" : "",
"position" : 1
}, {
"token" : "steel",
"start_offset" : 3,
"end_offset" : 8,
"type" : "",
"position" : 2
} ]
}

Which means that your text is analyzed into 2 tokens only (i.e. '29' and
'steel') by the default analyzer. See
http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze.html for
more details on the analyzer API.


(system) #3