q=+{!edismax qf='title^5 summary' v=$pq} {!parent which='parent:true'
score=max v=$favorsAU}&pq=great&favorsAU=#_parent_:false
{!func}product(field(rating),query($AU,1))&AU=country:AU^=2


>
> On Tue, Jul 4, 2023 at 9:43 PM Mikhail Khludnev <m...@apache.org> wrote:
>
>> Hello Ned.
>> Make sure you check the guide first
>> https://solr.apache.org/guide/solr/latest/query-guide/searching-nested-documents.html#parent-query-parser
>> Note that Solr syntax is cumbersome.
>> Basically you need to combine two queries parent and joined parents.
>> q=+{!edismax qf='title^5 summary' v=$pq} {!parent which='parent:true'
>> score=max v='+docType:author country:Au^=10'}&pq=great
>> After every attempt check debugQuery=true output to make sure the query
>> is pared as expected.
>> It make sense to start with JSON Query DSL.
>> Good luck.
>>
>> On Tue, Jul 4, 2023 at 5:44 PM nedyalko.zhe...@freelance.de.INVALID
>> <nedyalko.zhe...@freelance.de.invalid> wrote:
>>
>>>
>>> Hello everyone,
>>>
>>> we are using Solr for about 2 years and now we want to extend our
>>> queries to improve the relevance. In our case we have parent and child
>>> documents and in some cases child documents could help us to improve the
>>> way we are sorting the results. The problem is we didn't find at the moment
>>> an easy way to boost parent documents based on their child documents and we
>>> think we are doing something wrong, as this is a common use case. This
>>> could be an example of parent and child document:
>>>
>>> - Parent document
>>> {
>>>     "_parent_": true,
>>>     "_root_": "book/1"
>>>     "id": "book/1",
>>>     "docType": "book",
>>>     "title": "Great expectations"
>>>     "summary": "... some text ..."
>>> }
>>>
>>> - Child document
>>> {
>>>     "_parent_": false,
>>>     "_root_": "book/1"
>>>     "id": "author/1",
>>>     "docType": "author",
>>>     "name": "Charles Dickens"
>>>     "country": "England"
>>>     "rating": 4.6
>>> }
>>>
>>> This could be a query:
>>> q=great
>>> &defType=edismax
>>> &qf=title^5 summary
>>> &fq=docType:book
>>> &fl=*,score
>>>
>>> Now, how to extend this query if we want to add the rating field from
>>> author document to the related book document score? Furthermore, what if we
>>> want to boost books written by Australian authors adding two times their
>>> rating value? In both cases, how to get only parent documents in the result?
>>>
>>> Thank you in advance.
>>> Ned
>>>
>>
>>
>> --
>> Sincerely yours
>> Mikhail Khludnev
>>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


-- 
Sincerely yours
Mikhail Khludnev

Reply via email to