GroupedPayloadSpanQuery : Différence entre versions
De JDONREF Wiki
(Page créée avec « Ensure tokens with same payload values are grouped together. For example, the document : { "fullName": "BOULEVARD|1 DE|1 PARIS|1 L|2 HOPITAL|2" } will not match the re... ») |
|||
Ligne 3 : | Ligne 3 : | ||
For example, the document : |
For example, the document : |
||
{ "fullName": "BOULEVARD|1 DE|1 PARIS|1 L|2 HOPITAL|2" } |
{ "fullName": "BOULEVARD|1 DE|1 PARIS|1 L|2 HOPITAL|2" } |
||
+ | |||
+ | indexed with a mapping like : |
||
+ | |||
+ | "fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"myAnalyzer"} |
||
+ | |||
+ | and settings like : |
||
+ | |||
+ | { |
||
+ | "index" : { |
||
+ | "analysis" : { |
||
+ | "analyzer": { |
||
+ | "myAnalyzer" : { |
||
+ | "type" : "custom", |
||
+ | "tokenizer" : "whitespace", |
||
+ | "filter" : ["delimited_payload_filter", "lowercase"] |
||
+ | }, |
||
+ | "filter" : { |
||
+ | "delimited_payload_filter" : { |
||
+ | "type": "delimited_payload_filter", |
||
+ | "delimiter" : "|", |
||
+ | "encoding" : "int" |
||
+ | } |
||
+ | } |
||
+ | } |
||
will not match the request : |
will not match the request : |
||
− | curl -XPOST 'http://localhost:9200/_search' -d '{ |
+ | curl -XPOST 'http://localhost:9200/_search' -d '{ |
− | "query": { |
+ | "query": { |
"span_groupedpayload" : { |
"span_groupedpayload" : { |
||
"clauses" : [ |
"clauses" : [ |
||
− | { "fullName" : "BOULEVARD"} , |
+ | { "span_multipayloadterm" : { "fullName" : "BOULEVARD"}} , |
− | { "fullName" : "HOPITAL"} , |
+ | { "span_multipayloadterm" :{ "fullName" : "HOPITAL"}} , |
− | { "fullName" : "PARIS"} |
+ | { "span_multipayloadterm" :{ "fullName" : "PARIS"}} |
] |
] |
||
− | } |
+ | } |
− | }' |
+ | }' |
because token HOPITAL break the group of payload values from BOULEVARD and PARIS. |
because token HOPITAL break the group of payload values from BOULEVARD and PARIS. |
||
+ | |||
+ | the clauses element must be a list of one or more span_multipayloadterm type queries. |
Version du 28 septembre 2014 à 22:16
Ensure tokens with same payload values are grouped together.
For example, the document :
{ "fullName": "BOULEVARD|1 DE|1 PARIS|1 L|2 HOPITAL|2" }
indexed with a mapping like :
"fullName" : {"type": "string", "term_vector" : "with_positions_offsets_payloads", "index_analyzer":"myAnalyzer"}
and settings like :
{ "index" : { "analysis" : { "analyzer": { "myAnalyzer" : { "type" : "custom", "tokenizer" : "whitespace", "filter" : ["delimited_payload_filter", "lowercase"] }, "filter" : { "delimited_payload_filter" : { "type": "delimited_payload_filter", "delimiter" : "|", "encoding" : "int" } } }
will not match the request :
curl -XPOST 'http://localhost:9200/_search' -d '{ "query": { "span_groupedpayload" : { "clauses" : [ { "span_multipayloadterm" : { "fullName" : "BOULEVARD"}} , { "span_multipayloadterm" :{ "fullName" : "HOPITAL"}} , { "span_multipayloadterm" :{ "fullName" : "PARIS"}} ] } }'
because token HOPITAL break the group of payload values from BOULEVARD and PARIS.
the clauses element must be a list of one or more span_multipayloadterm type queries.