Yangrui,
First, have you indexed your documents with proper nested document structure
[https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers#UploadingDatawithIndexHandlers-NestedChildDocuments]?
From the peice of data you showed, it seems that you just put it right as it
is and it all got flattened.
Then, you'll probably want to introduce a distinguishing
"type"/"category"/"path" fields into your data, so it would look like this:
{
type:top
id:
{
type:car_color
car:
color:
}
{
type:driver_color
driver:
color:
}
}
>Wed, 20 Apr 2016 -3:28:33 -0400 от Yangrui Guo <[email protected]>:
>
>hello
>
>I have a nested document type in my index. Here's the structure of my
>document:
>
>{
>id:
>{
> car:
> color:
>}
>{
> driver:
> color:
>}
>}
>
>However, when I use the query q={!parent
>which="content_type:parent"}+(black AND driver)&fq={!parent
>which="content_type:parent"}+(white AND mercedes), the result also
>contained white driver with black mercedes. I know I can put fields before
>terms but it is not always easy to do this. Users might just enter one
>string. How can I modify my query to require that the terms between two
>parentheses must appear in the same child document, or boost those meet the
>criteria? Thanks