You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ho...@apache.org on 2007/02/22 01:37:52 UTC
svn commit: r510325 - in /lucene/solr/trunk: CHANGES.txt
src/java/org/apache/solr/request/DisMaxRequestHandler.java
src/java/org/apache/solr/util/DisMaxParams.java
src/test/org/apache/solr/DisMaxRequestHandlerTest.java
Author: hossman
Date: Wed Feb 21 16:37:51 2007
New Revision: 510325
URL: http://svn.apache.org/viewvc?view=rev&rev=510325
Log:
SOLR-158: new qs (Query Slop) param for DisMaxRequestHandler
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java
lucene/solr/trunk/src/java/org/apache/solr/util/DisMaxParams.java
lucene/solr/trunk/src/test/org/apache/solr/DisMaxRequestHandlerTest.java
Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?view=diff&rev=510325&r1=510324&r2=510325
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Wed Feb 21 16:37:51 2007
@@ -115,6 +115,11 @@
using SolrQueryParser syntax as a mechanism for specifying what query
the dismax handler should execute if the main user query (q) is blank.
(Ryan McKinley via hossman)
+
+15. SOLR-158: new "qs" (Query Slop) param for DisMaxRequestHandler
+ allows for specifying the amount of default slop to use when parsing
+ explicit phrase queries from the user.
+ (Adam Hiatt via hossman)
Changes in runtime behavior
1. Highlighting using DisMax will only pick up terms from the main
Modified: lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java?view=diff&rev=510325&r1=510324&r2=510325
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java Wed Feb 21 16:37:51 2007
@@ -85,6 +85,9 @@
* <li> ps - (Phrase Slop) amount of slop on phrase queries built for pf
* fields.
* </li>
+ * <li> ps - (Query Slop) amount of slop on phrase queries explicitly
+ * specified in the "q" for qf fields.
+ * </li>
* <li> bq - (Boost Query) a raw lucene query that will be included in the
* users query to influence the score. If this is a BooleanQuery
* with a default boost (1.0f), then the individual clauses will be
@@ -176,6 +179,7 @@
float tiebreaker = params.getFloat(DMP.TIE, 0.0f);
int pslop = params.getInt(DMP.PS, 0);
+ int qslop = params.getInt(DMP.QS, 0);
/* a generic parser for parsing regular lucene queries */
QueryParser p = new SolrQueryParser(schema, null);
@@ -187,7 +191,8 @@
new U.DisjunctionMaxQueryParser(schema, IMPOSSIBLE_FIELD_NAME);
up.addAlias(IMPOSSIBLE_FIELD_NAME,
tiebreaker, queryFields);
-
+ up.setPhraseSlop(qslop);
+
/* for parsing slopy phrases using DisjunctionMaxQueries */
U.DisjunctionMaxQueryParser pp =
new U.DisjunctionMaxQueryParser(schema, IMPOSSIBLE_FIELD_NAME);
Modified: lucene/solr/trunk/src/java/org/apache/solr/util/DisMaxParams.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/DisMaxParams.java?view=diff&rev=510325&r1=510324&r2=510325
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/util/DisMaxParams.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/util/DisMaxParams.java Wed Feb 21 16:37:51 2007
@@ -55,8 +55,16 @@
public static String PF = "pf";
/** query and init param for MinShouldMatch specification */
public static String MM = "mm";
- /** query and init param for Phrase Slop value */
+ /**
+ * query and init param for Phrase Slop value in phrase
+ * boost query (in pf fields)
+ */
public static String PS = "ps";
+ /**
+ * query and init param for phrase Slop value in phrases
+ * explicitly included in the user's query string ( in qf fields)
+ */
+ public static String QS = "qs";
/** query and init param for boosting query */
public static String BQ = "bq";
/** query and init param for boosting functions */
Modified: lucene/solr/trunk/src/test/org/apache/solr/DisMaxRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/DisMaxRequestHandlerTest.java?view=diff&rev=510325&r1=510324&r2=510325
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/DisMaxRequestHandlerTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/DisMaxRequestHandlerTest.java Wed Feb 21 16:37:51 2007
@@ -121,6 +121,18 @@
"facet", "false" )
,"//*[@numFound='0']"
);
+
+ assertQ("no query slop == no match",
+ req( "qt", "dismax",
+ "q", "\"cool chick\"" )
+ ,"//*[@numFound='0']"
+ );
+ assertQ("query slop == match",
+ req( "qt", "dismax",
+ "qs", "2",
+ "q", "\"cool chick\"" )
+ ,"//*[@numFound='1']"
+ );
}
public void testOldStyleDefaults() throws Exception {
Re: svn commit: r510325 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/request/DisMaxRequestHandler.java src/java/org/apache/solr/util/DisMaxParams.java src/test/org/apache/solr/DisMaxRequestHandlerTest.java
Posted by Yonik Seeley <yo...@apache.org>.
On 2/21/07, hossman@apache.org <ho...@apache.org> wrote:
> + * <li> ps - (Query Slop) amount of slop on phrase queries explicitly
> + * specified in the "q" for qf fields.
Ahh, thanks for the additional code comments... I was a bit confused
since there already was a phrase slop param.
-Yonik