Reputation: 793
I am trying to query solr documents based on criteria both in parent and a child.
Documentation: BlockJoinQueryParsers instructs to use a query like:
q= +title:join +{!parent which="content_type:parentDocument"}comments:SolrCloud
where title
is a parent's field and comments
is child's.
A query like this works fine. However, I can not add any other condition on the child. No matter what statement I try to put after the '}', it fails with SyntaxError. For example
q= +title:join +{!parent which="content_type:parentDocument"}(comments:SolrCloud AND id:4)
fails with SyntaxError.
I think I can use a workaround by utilizing fq parameter, but I wonder if it is possible to achieve in one query.
P.S. I am using Solr 6.6, and upgrading to version 7 can be considered.
Upvotes: 1
Views: 1302
Reputation: 9320
You need to use local parameters, basically your query is equal to
q= +title:join +{!parent which="content_type:parentDocument" v='comments:SolrCloud'}
which could be rewritten even further:
q= +title:join +{!parent which="content_type:parentDocument" v=$qq}&qq=+comments:SolrCloud +whatever:ClauseYouWant
Upvotes: 2