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 de...@geschan.de on 2014/01/22 19:17:20 UTC
Searching and scoring with block join
Hello again,
I'm using the solr block-join feature to index a journal and all of
it's articles.
Here a short example:
<add>
<doc>
<field name="id">527fcbf8-c140-4ae6-8f51-68cd2efc1343</field>
<field name="title">Sozialmagazin</field>
<field name="issue">8</field>
<field name="year">2008</field>
<field name="issn">0340-8469</field>
<field name="description">...</field>
<field name="publisher">juventa</field>
<field name="tags">...</field>
<field name="is_parent">true</field>
<doc>
<field name="id">527fcb34-4570-4a86-b9e7-68cd2efc1343</field>
<field name="article">A World out of Balance</field>
<field name="page">62</field>
<field name="author">Amthor</field>
<field name="content_en">...</field>
<field name="tags">...</field>
</doc>
<doc>
<field name="id">527fcbf8-84ec-424f-9d58-68cd2efc1343</field>
<field name="article">Die Philosophie des Helfens</field>
<field name="page">50</field>
<field name="author">Keck</field>
<field name="content_en">...</field>
<field name="tags">...</field>
</doc>
</doc>
</add>
I read about the search syntax in this article:
http://blog.griddynamics.com/2013/09/solr-block-join-support.html
Yet I'm wondering, how to use it properly. If I want to make a
"fulltext" search over all journals and their articles and getting the
journals with the highest score as result, how should my query look
like?
I know that I can't just make a query like this: {!parent
which=is_parent:true}+Term, most likely I'll get this error: child
query must only match non-parent docs, but parent docID=XXXX matched
childScorer=class org.apache.lucene.search.TermScorer
So, how do I make a query that is searching in both, journals and
articles, giving me the journals ordered by their score? How do I get
the score of the child documents to be added to the score of the
parent document?
Thank you for your help.
- Gesh
Re: Searching and scoring with block join
Posted by Mikhail Khludnev <mk...@griddynamics.com>.
On Fri, Jan 24, 2014 at 9:32 PM, <de...@geschan.de> wrote:
>
> Zitat von Mikhail Khludnev <mk...@griddynamics.com>:
>
> nesting query parsers is shown at
>> http://blog.griddynamics.com/2013/12/grandchildren-and-
>> siblings-with-block.html
>>
>> try to start from the following:
>> title:Test _query_:"{!parent which=is_parent:true}{!dismax
>> qf=content_de}Test"
>> mind about local params referencing eg {!... v=$nest}&nest=...
>>
>
> Thank you for the hint.
> I don't really know how {!dismax ...} and local parameter referencing are
> solving my problem.
> I read your blog entry, but I have some issues to understand how I can use
> your explanations.
> Would you mind giving me a short example how these query params helping me
> to get a proper result with a combined score for parent and children?
>
Hello,
I'm not able to provide you much support. You can start from
https://cwiki.apache.org/confluence/display/solr/Local+Parameters+in+Queries
>
> Thank you very much.
>
>
> there is no such parm in
>> https://github.com/apache/lucene-solr/blob/trunk/solr/
>> core/src/java/org/apache/solr/search/join/BlockJoinParentQParser.java#L67
>> Raise an feature request issue, at least, don't hesitate to contribute.
>>
>> Ah, okay, it was a misunderstanding then.
> I created an issue: https://issues.apache.org/jira/browse/SOLR-5662
>
>
> Sorry if I ask stupid questions but I just have started to work with solr
>>> and some techniques are not very familiar.
>>>
>>>
>
> Thanks
> -Gesh
>
>
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<mk...@griddynamics.com>
Re: Searching and scoring with block join
Posted by de...@geschan.de.
Zitat von Mikhail Khludnev <mk...@griddynamics.com>:
> nesting query parsers is shown at
> http://blog.griddynamics.com/2013/12/grandchildren-and-siblings-with-block.html
>
> try to start from the following:
> title:Test _query_:"{!parent which=is_parent:true}{!dismax
> qf=content_de}Test"
> mind about local params referencing eg {!... v=$nest}&nest=...
Thank you for the hint.
I don't really know how {!dismax ...} and local parameter referencing
are solving my problem.
I read your blog entry, but I have some issues to understand how I can
use your explanations.
Would you mind giving me a short example how these query params
helping me to get a proper result with a combined score for parent and
children?
Thank you very much.
> there is no such parm in
> https://github.com/apache/lucene-solr/blob/trunk/solr/core/src/java/org/apache/solr/search/join/BlockJoinParentQParser.java#L67
> Raise an feature request issue, at least, don't hesitate to contribute.
>
Ah, okay, it was a misunderstanding then.
I created an issue: https://issues.apache.org/jira/browse/SOLR-5662
>> Sorry if I ask stupid questions but I just have started to work with solr
>> and some techniques are not very familiar.
>>
Thanks
-Gesh
Re: Searching and scoring with block join
Posted by Mikhail Khludnev <mk...@griddynamics.com>.
> Yes, that's correct.
>
> I also already tried the query you brought as example, but I have problems
> with the scoring.
> I'm using edismax as defType, but I'm not quite sure how to use it with a
> {!parent } query.
>
nesting query parsers is shown at
http://blog.griddynamics.com/2013/12/grandchildren-and-siblings-with-block.html
try to start from the following:
title:Test _query_:"{!parent which=is_parent:true}{!dismax
qf=content_de}Test"
mind about local params referencing eg {!... v=$nest}&nest=...
> For example, if I do this query, the score is always 0
> {!parent which=is_parent:true}+content_de:Test
> The blog says: ToParentBlockJoinQuery supports a few modes of score
> calculations. {!parent} parser has None mode hardcoded.
> So, can I change the hardcoded mode somehow? I didn't find any further
> documentation about the parameters of {!parent}.
>
there is no such parm in
https://github.com/apache/lucene-solr/blob/trunk/solr/core/src/java/org/apache/solr/search/join/BlockJoinParentQParser.java#L67
Raise an feature request issue, at least, don't hesitate to contribute.
> If I'm doing this request, the score seems only be calculated by the
> results found in "title".
> title:Test _query_:"{!parent which=is_parent:true}+content_de:Test"
>
> Sorry if I ask stupid questions but I just have started to work with solr
> and some techniques are not very familiar.
>
> Thanks
> -Gesh
>
>
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<mk...@griddynamics.com>
Re: Searching and scoring with block join
Posted by de...@geschan.de.
Zitat von Mikhail Khludnev <mk...@griddynamics.com>:
> On Wed, Jan 22, 2014 at 10:17 PM, <de...@geschan.de> wrote:
>
>> I know that I can't just make a query like this: {!parent
>> which=is_parent:true}+Term, most likely I'll get this error: child query
>> must only match non-parent docs, but parent docID=XXXX matched
>> childScorer=class org.apache.lucene.search.TermScorer
>>
>
> Hello Gesh,
>
> As it's state there child clause should not match any parent docs, but the
> query +Term matches them because it applies some default field which, I
> believe belongs to parent docs.
>
> That blog has an example of searching across both 'scopes'
> q=+BRAND_s:Nike +_query_:"{!parent which=type_s:parent}+COLOR_s:Red
> +SIZE_s:XL"
> mind exact fields specified for both scopes. In your case you need to
> switch from conjunction '+' to disjunction.
>
Hello Mikhail,
Yes, that's correct.
I also already tried the query you brought as example, but I have
problems with the scoring.
I'm using edismax as defType, but I'm not quite sure how to use it
with a {!parent } query.
For example, if I do this query, the score is always 0
{!parent which=is_parent:true}+content_de:Test
The blog says: ToParentBlockJoinQuery supports a few modes of score
calculations. {!parent} parser has None mode hardcoded.
So, can I change the hardcoded mode somehow? I didn't find any further
documentation about the parameters of {!parent}.
If I'm doing this request, the score seems only be calculated by the
results found in "title".
title:Test _query_:"{!parent which=is_parent:true}+content_de:Test"
Sorry if I ask stupid questions but I just have started to work with
solr and some techniques are not very familiar.
Thanks
-Gesh
Re: Searching and scoring with block join
Posted by Mikhail Khludnev <mk...@griddynamics.com>.
On Wed, Jan 22, 2014 at 10:17 PM, <de...@geschan.de> wrote:
> I know that I can't just make a query like this: {!parent
> which=is_parent:true}+Term, most likely I'll get this error: child query
> must only match non-parent docs, but parent docID=XXXX matched
> childScorer=class org.apache.lucene.search.TermScorer
>
Hello Gesh,
As it's state there child clause should not match any parent docs, but the
query +Term matches them because it applies some default field which, I
believe belongs to parent docs.
That blog has an example of searching across both 'scopes'
q=+BRAND_s:Nike +_query_:"{!parent which=type_s:parent}+COLOR_s:Red
+SIZE_s:XL"
mind exact fields specified for both scopes. In your case you need to
switch from conjunction '+' to disjunction.
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<mk...@griddynamics.com>