lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <mkhlud...@griddynamics.com>
Subject Re: Sorting documents by nested / child docs with FunctionQueries
Date Wed, 24 Jun 2015 22:28:26 GMT
Just pulled and launched Solr 5.2.1

dropped multivalued child into see data below. Response is quite correct:

"id":"22", "COLOR_s":"Blue","SIZE_ss":["XL","XXL"]}]}]

http://localhost:8983/solr/solr/select?q={!parent+which%3Dtype_s%3Aparent}%2BCOLOR_s%3ABlue+%2BSIZE_ss%3AXL&fl=id%2C[child+parentFilter%3Dtype_s%3Aparent+childFilter%3D-type_s%3Aparent+limit%3D100]&wt=json&indent=true

{
  "responseHeader":{
    "status":0,
    "QTime":3,
    "params":{
      "q":"{!parent which=type_s:parent}+COLOR_s:Blue +SIZE_ss:XL",
      "indent":"true",
      "fl":"id,[child parentFilter=type_s:parent
childFilter=-type_s:parent limit=100]",
      "wt":"json"}},
  "response":{"numFound":2,"start":0,"docs":[
      {
        "id":"10",
        "_childDocuments_":[
        {
          "id":"11",
          "COLOR_s":"Red",
          "SIZE_ss":["XL"]},
        {
          "id":"12",
          "COLOR_s":"Blue",
          "SIZE_ss":["XL"]}]},
      {
        "id":"20",
        "_childDocuments_":[
        {
          "id":"21",
          "COLOR_s":"Red",
          "SIZE_ss":["M"]},
        {
          "id":"22",
          "COLOR_s":"Blue",
          "SIZE_ss":["XL",
            "XXL"]}]}]
  }}

<update>
  <delete><query>*:*</query></delete>
  <add>
    <doc>
      <field name="id">10</field>
      <field name="type_s">parent</field>
      <field name="BRAND_s">Nike</field>
      <doc>
        <field name="id">11</field>
        <field name="COLOR_s">Red</field>
        <field name="SIZE_ss">XL</field>
      </doc>
      <doc>
        <field name="id">12</field>
        <field name="COLOR_s">Blue</field>
        <field name="SIZE_ss">XL</field>
      </doc>
    </doc>
    <doc>
      <field name="id">20</field>
      <field name="type_s">parent</field>
      <field name="BRAND_s">Nike</field>
      <doc>
        <field name="id">21</field>
        <field name="COLOR_s">Red</field>
        <field name="SIZE_ss">M</field>
      </doc>
      <doc>
        <field name="id">22</field>
        <field name="COLOR_s">Blue</field>
        <field name="SIZE_ss">XL</field>
        <field name="SIZE_ss">XXL</field>
      </doc>
    </doc>
    <doc>
      <field name="id">30</field>
      <field name="type_s">parent</field>
      <field name="BRAND_s">Puma</field>
      <doc>
        <field name="id">31</field>
        <field name="COLOR_s">Red</field>
        <field name="SIZE_ss">XL</field>
      </doc>
      <doc>
        <field name="id">32</field>
        <field name="COLOR_s">Blue</field>
        <field name="SIZE_ss">M</field>
      </doc>
    </doc>
  </add>
  <commit/>
</update>



On Mon, Jun 22, 2015 at 2:04 PM, Maya G <maiki89g@gmail.com> wrote:

> I've tried your solution and encountered a problem.
>
> My child document has a multi-valued field.
>
> When I query the doc by its' guid, all of the field's values are returned.
> When I use the join block query only one value is returned for the
> multi-value field.
>
> Do you have any suggestions?
> Thank you,
> Maya
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Sorting-documents-by-nested-child-docs-with-FunctionQueries-tp4209940p4213242.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mkhludnev@griddynamics.com>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message