My apologize Mikhail, I try to explain it better :

This is actually what I get from SOLR with the query you helped me to build
:

"responseHeader":{
    "status":0,
    "QTime":15,
    "params":{
      "q":"{!parent which=object_type_s:contact score=max v=$chq}",
      "indent":"on",
      "fl":"*,score,[child parentFilter=object_type_s:contact]",
      "fq":["_query_:\"{!parent which=object_type_s:contact} (enseigne_s:SAV
AND (type_cde_s:CDE OR type_cde_s:REASSORT) AND campagne_s:G)\"",
        "-_query_:\"{!parent which=object_type_s:contact} (enseigne_s:SAV
AND type_cde_s:KIT AND campagne_s:I)\"",
        "{!frange l=30000}{!parent which=object_type_s:contact score=total
v=$chq}"],
      "chq":"+object_type:order +campagne_s:G +enseigne_s:SAV
+type_cde_s:(CDE OR REASSORT) {!func}TTC_i",
      "wt":"json",
      "debugQuery":"on",
      "_":"1531145722719"}},
  "response":{"numFound":2,"start":0,"maxScore":31640.16,"docs":[
      {
        "id":"94000.94001.1117636",
        "parent_i":94000,
        "asso_i":94001,
        "personne_i":1117636,
        "object_type_s":"contact",
        "date_derni_re_commande_dt":"2017-11-13T00:00:00Z",
        "_version_":1605583100313600002,
        *"score":31640.16*,
        "_childDocuments_":[
        {
          "object_type":["order"],
          "TTC_i":0,
          "type_cde_s":"KIT",
          "campagne_s":"G",
          "enseigne_s":"SAV"
         },
        {
          "object_type":["order"],
          "TTC_i":31636,
          "type_cde_s":"CDE",
          "campagne_s":"G",
          "enseigne_s":"SAV"
         }

I already get the TTC_i sum, by parent document with the "score" parameter.
If I correctly understand, the {!frange} allows me to filter on that
"score", so I can get the result of that question : "get the parent which
sum of TTC_i, with campagne_s:G and enseigne_s:SAV and type_cde_s:CDE or
type_cde_s:REASSORT, is higher than 30000".

If you think it's OK, I get the results I wanted. Then my goal is to build a
facet to get the number of parent docs which answer to the query, with
others constraints (like only one campagne_s, etc).
I think I have to use the json facet API, with facet.pivot for example.

Do you think I'm on the right way ?

Best

JB



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to