PayloadCheckerSpanFilter

De JDONREF Wiki

Check results for grammar rules according to payloads values.

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.


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 { "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" }
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 (coming soon) 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" : {...} }