lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <m...@apache.org>
Subject Re: Matching parent docs when two child docs match different criteria
Date Mon, 05 Feb 2018 19:35:54 GMT
q=+{!parent .. v=$m} +{!parent .. v=$l}&m=size:(+M -L)&l=size:(+L -M)

On Sun, Feb 4, 2018 at 10:56 PM, SuperMattio86 <matt.peyrard@gmail.com>
wrote:

> Hello.
>
> As a toy example, let's assume I have documents that looks like this:
>
> {
>   "id": "1",
>   "_childDocuments_": [
>      {
>         "id": "1_2",
>         "_path_": "p.1",
>          "size": "M",
>          "color": "red"
>       },
>      {
>         "id": "23lk4d23lkj",
>         "_path_": "p.2",
>          "size": "L",
>          "color": "blue"
>     }
>   ]
> }
>
> Is it possible to construct a query that will match a parent doc that has a
> child doc that say matches 'size:L' and a DIFFERENT child that matches
> 'size:M'? Is such a query possible? What would it look like? Or would I
> need
> to implement a custom query parser to do this?
>
> I can currently do this without sub-documents, by indexing those values as
> arrays, and creating a custom scorer/collector that collects positions in
> addition to docs, but since I am now switching to a version of Solr that
> has
> sub-documents, I was hoping for a better solution that more intuitively
> models my data structures.
>
>
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>



-- 
Sincerely yours
Mikhail Khludnev

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