I just want to combine block join query and main-query with edismax-parser as I do it for solr < 7.2
berlin OR _query_:"{!parent which=type:book}page_content:berlin"
But edismax cannot be the default-Parser for this purpose any more(s. https://issues.apache.org/jira/browse/SOLR-11501)
So it works with lucene-QueryParser for querying parents:
q={!parent which="type:book"}{!edismax qf='page_content' v='berlin'}
it still works for adding main query like
q=title:berlin* AND {!parent which="type:book"}{!edismax qf='page_content' v='berlin'}
but when I try
q={!edismax qf='title' v='berlin'} OR {!parent which="type:book"}{!edismax qf='page_content' v='berlin'}
only the first part of the query is evaluated.
My docs are:
<add>
<doc>
<field name="id">1</field>
<field name="type">book</field>
<field name="title">Book about Berlin</field>
<field name="pages">
<doc>
<field name="id">11</field>
<field name="type">page</field>
<field name="page_content">berlin in winter</field>
</doc>
<doc>
<field name="id">12</field>
<field name="type">page</field>
<field name="page_content">berlin in spring</field>
</doc>
<doc>
<field name="id">13</field>
<field name="type">page</field>
<field name="page_content">berlin in summer</field>
</doc>
</field>
</doc>
<doc>
<field name="id">2</field>
<field name="type">book</field>
<field name="title">Big book about Tokio</field>
<field name="pages">
<doc>
<field name="id">21</field>
<field name="type">page</field>
<field name="page_content">tokio in winter</field>
</doc>
<doc>
<field name="id">22</field>
<field name="type">page</field>
<field name="page_content">tokio in spring</field>
</doc>
<doc>
<field name="id">23</field>
<field name="type">page</field>
<field name="page_content">tokio in summer</field>
</doc>
</field>
</doc>
</add>
Does anybody have the same problem?
Thanks a lot!
That is because, as of Solr 7.3, the defaults regarding searchable fields for edismax actually prohibits the use of embedded query.
Fortunately, this behavior can be managed with
ufparameter.Set
uf=* _query_to allow embedded queries.I tested it on Solr 7.7.1, it works but I had to wrap the embedded query in double quotes otherwise the whole query fails returning 0 result without any notice.
This query should work :
Note : There are examples in documentation for Solr < 7.3 mentioning a comma-separated list in
ufparameter, but the expected separator is definitely a space.For those who are not using edismax you will have to set
luceneMatchVersion=7.1.0for full backward compatibility.