Hi thanks for answering. My problem is that users do not distinguish what color the color belongs to in the query. For example, "which black driver has a white mercedes", it is difficult to distinguish which color belongs to which field, because there can be thousands of car brands and professions. Is there anyway that can achieve the feature I stated been fore?
On Wednesday, April 20, 2016, Alisa Z. <prol...@mail.ru> wrote: > 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 <guoyang...@gmail.com > <javascript:;>>: > > > >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 > >