You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Mikhail Khludnev <gg...@gmail.com> on 2016/07/01 20:49:05 UTC

Re: Searching inside parent AND children, returning only parents.

Yep, query syntax is a little bit challenging. Here I'm showing query
nesting to answer your question and also a better syntax for boolean
queries:

q={!parent which="parentDoc:true" v=$childq} (+parentDoc:true
+<searchTerm>) &childq=+parentDoc:false +<searched term>
30 июня 2016 г. 10:11 пользователь "Marre" <Ma...@gmail.com> написал:

> I have been experimenting with solr for a couple of weeks but i've been
> stuck
> on a query i would like to execute for a couple of days now.
>
> I have a nested data structure where I'm using a fq like this:
>
> {!parent which="parentDoc:true"}parentDoc:false AND <searched term>
>
> This matches my child documents and returns the parent to those children. I
> am very pleased with that. BUT the problem i have is if there is a match
> directly inside the parent and nothing in the children. I will not get a
> response.
>
> I would make it so that in some way there is a OR condition of some sort
> making it so, any document can match the searched term AND parentDoc:false
> OR the above filter query.
>
> Is this even possible to execute within one query in solr, or do i have to
> make two? I have not found any information about this issue, making me to
> believe im just missing something trivial.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Searching-inside-parent-AND-children-returning-only-parents-tp4285078.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>