PayloadCheckerSpanFilter
De JDONREF Wiki
Révision de 25 octobre 2014 à 10:53 par Julien2512 (discussion | contributions)
Check results for grammar rules according to payloads values.
Sample
For example, the document :
{ "fullName": "BOULEVARD|1 DE|1 PARIS|1 07|2 L|3 HOPITAL|3" }
with the following mapping :
"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", "tokencount_payload_filter"] } }, "filter" : { "delimited_payload_filter" : { "type": "delimited_payload_filter", "delimiter" : "|", "encoding" : "int" }, "tokencount_payload_filter" : { "type": "tokencountpayloads", "factor": 1000 } } }
will match the query :
{ "span_payloadchecker" : { "clauses": [ { "span_multipayloadterm" : { "fullName": "BOULEVARD" } }, { "span_multipayloadterm" : { "fullName": "PARIS" } }, { "span_multipayloadterm" : { "fullName": "HOPITAL" } } ], "checker": { "type":"Grouped" } } }
but not match the following :
{ "span_payloadchecker" : { "clauses": [ { "span_multipayloadterm" : { "fullName": "BOULEVARD" } }, { "span_multipayloadterm" : { "fullName": "HOPITAL" } } { "span_multipayloadterm" : { "fullName": "PARIS" } }, ], "checker": { "type":"Grouped" } } }
because eventhough they got the same payload BOULEVARD and PARIS are not grouped together in the second request.
Checkers
Notice the following checkers :
checker type | description | sample |
And | All the given checkers from data array must validate to validate the document | { "type":"And", "checkers" : [ ... ] } |
Or | One of the given checkers from data array must validate to validate the document | { "type":"Or", "checkers" : [ ... ] } |
Xor | Only one of the given checkers from data array must validate to validate the document | { "type":"Xor", "checkers" : [ ... ] } |
Not | The given checker 'data' must not validate to validate the document | { "type":"Not", "checker" : { ... } } |
All | All the tokens with the given payload (bytes[] or int) must match to validate the document. You will need tokencountpayloads token filter for that. | { "type":"All", "payload" : "AAAD8Q==" } |
One | One token with the given payload (bytes[] or int) must match to validate the document | { "type":"One", "payload" : "AAAD8Q==" } |
Field | Field value (default to _type) must match to validate the document | { "type":"Field", "field" : "type_de_voie", "value" : "BOULEVARD" } |
Grouped | Groups of tokens by payloads must not interlace to validate the document | { "type":"Grouped" } |
BeforeAnother | Check whether tokens with a given payload are just before another group of payloads | { "type":"BeforeAnother", "payloadbefore" : "AAAD8Q==", "another" : "AAAD8Q==" } |
If | If the condition match, the then clause must match to validate the document. Otherwise it matches. Be aware of performances. | { "type":"If", "condition" : {...}, "then" : {...} } |
IfElse | If the condition match, the then clause must match to validate the document. If the condition does not match, the else clause must match to validate the document. Be aware of performances (see Switch) | { "type":"IfElse", "condition" : {...}, "then" : {...}, "else" : {...} } |
Switch | If a switch condition clause match, the switch clause must match to validate the document. Default not customizable set to true (Null). | { "type":"Switch", "field" : "_type", "clauses" : { "adresse": { ... }, "commune": { ... } } } |
Limit | Validate the "limit" first documents. | { "type":"Limit", "limit" : 100 } |
Null | Validate all documents | { "type":"Null" } |