mirror of https://github.com/apache/lucene.git
SOLR-3823: Fix 'bq' parsing in edismax. Please note that this required reverting the negative boost support added by SOLR-3278
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1383708 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
122bf3435f
commit
64d204c04e
|
@ -149,6 +149,8 @@ Bug Fixes
|
|||
if it is configured as multiValued - this has never been properly supported,
|
||||
but previously failed silently in odd ways. (hossman)
|
||||
|
||||
* SOLR-3823: Fix 'bq' parsing in edismax. Please note that this required
|
||||
reverting the negative boost support added by SOLR-3278 (hossman)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -346,17 +346,13 @@ class ExtendedDismaxQParser extends QParser {
|
|||
|
||||
/* * * Boosting Query * * */
|
||||
boostParams = solrParams.getParams(DisMaxParams.BQ);
|
||||
//List<Query> boostQueries = U.parseQueryStrings(req, boostParams);
|
||||
boostQueries=null;
|
||||
if (boostParams!=null && boostParams.length>0) {
|
||||
Map<String,Float> bqBoosts = SolrPluginUtils.parseFieldBoosts(boostParams);
|
||||
boostQueries = new ArrayList<Query>();
|
||||
for (Map.Entry<String,Float> bqs : bqBoosts.entrySet()) {
|
||||
if (bqs.getKey().trim().length()==0) continue;
|
||||
Query q = subQuery(bqs.getKey(), null).getQuery();
|
||||
Float b = bqs.getValue();
|
||||
if(b!=null) {
|
||||
q.setBoost(b);
|
||||
}
|
||||
for (String qs : boostParams) {
|
||||
if (qs.trim().length()==0) continue;
|
||||
Query q = subQuery(qs, null).getQuery();
|
||||
boostQueries.add(q);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -343,8 +343,24 @@ public class TestExtendedDismaxParser extends AbstractSolrTestCase {
|
|||
"//doc[3]/str[@name='id'][.='52']"
|
||||
);
|
||||
|
||||
// non-trivial bqs
|
||||
assertQ(req("q", "tekna",
|
||||
"qf", "text_sw",
|
||||
"defType", "edismax",
|
||||
"bq", "(text_sw:blasdfadsf id:54)^100",
|
||||
"bq", "id:[53 TO 53]^10",
|
||||
"fq", "id:[52 TO 54]",
|
||||
"fl", "id,score"),
|
||||
"//doc[1]/str[@name='id'][.='54']",
|
||||
"//doc[2]/str[@name='id'][.='53']",
|
||||
"//doc[3]/str[@name='id'][.='52']"
|
||||
);
|
||||
|
||||
// genuine negative boosts are not legal
|
||||
// see SOLR-3823, SOLR-3278, LUCENE-4378 and
|
||||
// https://wiki.apache.org/solr/SolrRelevancyFAQ#How_do_I_give_a_negative_.28or_very_low.29_boost_to_documents_that_match_a_query.3F
|
||||
assertQ(
|
||||
req("q", "tekna", "qf", "text_sw", "defType", "edismax", "bq", "id:54^-100", "bq", "id:53^10", "bq", "id:52", "fq", "id:[52 TO 54]", "fl", "id,score"),
|
||||
req("q", "tekna", "qf", "text_sw", "defType", "edismax", "bq", "(*:* -id:54)^100", "bq", "id:53^10", "bq", "id:52", "fq", "id:[52 TO 54]", "fl", "id,score"),
|
||||
"//doc[1]/str[@name='id'][.='53']",
|
||||
"//doc[2]/str[@name='id'][.='52']",
|
||||
"//doc[3]/str[@name='id'][.='54']"
|
||||
|
|
Loading…
Reference in New Issue