Subquery is a good idea here too.  It's slower but it's also more powerful,
more general.

I'll try and get SOLR-15156 into 8.9

~ David Smiley
Apache Lucene/Solr Search Developer
http://www.linkedin.com/in/davidwsmiley


On Thu, May 6, 2021 at 3:42 PM Jonathan Bridges <jondbrid...@gmail.com>
wrote:

> Thanks David for confirming this and the work around, really appreciate it.
>
> I also found a subquery could give correct results, though haven't tested
> performance comparison with childFilter. I had never used subquery before
> so it hadn't occurred to me. Will try them both out.
>
> fq={!parent which='docType:factory'} docType:widget AND color:Red AND
> size:Large
> fl=*, widgets:[subquery]
> widgets.q=docType: child_doc_type AND color: Red AND size: Large
> widgets.fq={!terms f=_nest_parent_ v=$row.id}
>
> Thanks again,
> Jon Bridges
>
>
> On Thu, May 6, 2021 at 9:38 AM David Smiley <dsmi...@apache.org> wrote:
>
> > Hi,
> >
> > It appears this was broken in 8.0 by
> > https://issues.apache.org/jira/browse/SOLR-12768
> > And then fixed in 9.0 (not released) by SOLR-15156
> >
> > I didn't back-port the fix because I thought users might be relying on
> the
> > escaping behavior.  I didn't realize such escaping didn't exist before
> > SOLR-12768.  In light of this, the change would make an appropriate
> > addition to 8.9 but not a bug-fix version.
> >
> > A work-around is to express your query without colons, since the internal
> > logic is gated on that.  So something like:
> >    childFilter='+{!field f=docType v=child_doc_type} +{!field f=color
> > v=Red}'        etc.   Disclaimer: I didn't test that; it *may* be
> necessary
> > to move out some of this into other parameters based on parsing
> > rules/restrictions e.g. childFilter=$theChildFilter  and then add a
> > top-level param.  But I think it's not needed.
> >
> > ~ David Smiley
> > Apache Lucene/Solr Search Developer
> > http://www.linkedin.com/in/davidwsmiley
> >
> >
> > On Tue, May 4, 2021 at 6:30 PM Jonathan Bridges <jondbrid...@gmail.com>
> > wrote:
> >
> > > Hello,
> > >
> > > With Solr 8.8.2 I am unable to provide more than one filter in the fl
> > > "childFilter" param.
> > >
> > > For example,
> > >
> > > fq={!parent which='docType:parent_doc_type'} docType: child_doc_type
> AND
> > > color: Red AND size: Large
> > >
> > > This fq will filter all parent documents which have child documents
> that
> > > are 'Red' and 'Large'.
> > >
> > > Now I want to show the parents with the children in the result, but
> only
> > > the children which are 'Red' and 'Large'. In the past (Solr v6) I would
> > > accomplish this with:
> > >
> > > fl=*, [child childFilter='docType:child_doc_type AND color: Red AND
> size:
> > > Large']
> > > However, with Solr 8.8.2 I get no children in the results and no
> errors.
> > >
> > > If I remove the extra AND conditions:
> > >
> > > fl=*, [child childFilter='docType:child_doc_type']
> > > I then get all child documents, even ones which are Blue and Small.
> > >
> > > How can I include only child documents which match the fq? Is there
> some
> > > way to specify multiple conditions now that I just can't find in the
> > docs?
> > >
> > > Thanks for any help.
> > >
> >
>

Reply via email to