Exact string match query


(arien) #1

Hi;
I want to have results of exact query match which should consider all
case sensitiveness,along with number formats in the query.
Suppose if i want to search for filename : "DoCument2.doc",query
should return me only those results having filename as such.
I closest i could get with such is term query but i observed that it
does not support number format and gives null results for
"DoCument2.doc".Have tried text query also but does gives some close
matches results also.i m using no analyzers apart from default.
Please help me out in this.
thanks;
Ajay


(Clinton Gormley) #2

On Mon, 2011-10-10 at 05:08 -0700, arien wrote:

Hi;
I want to have results of exact query match which should consider all
case sensitiveness,along with number formats in the query.
Suppose if i want to search for filename : "DoCument2.doc",query
should return me only those results having filename as such.
I closest i could get with such is term query but i observed that it
does not support number format and gives null results for
"DoCument2.doc".Have tried text query also but does gives some close
matches results also.i m using no analyzers apart from default.

There is the problem. By default your string values are being analyzed.
If you want to match a string value exactly, then you must store the
value in the correct form: in this case not analyzed.

You should set the mapping for that field to

{ type: "string", index: "not_analyzed" }

clint


(system) #3