lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ans...@apache.org
Subject svn commit: r1635329 - in /lucene/dev/trunk/solr/core/src: java/org/apache/solr/search/mlt/ test/org/apache/solr/search/ test/org/apache/solr/search/mlt/
Date Wed, 29 Oct 2014 23:10:17 GMT
Author: anshum
Date: Wed Oct 29 23:10:17 2014
New Revision: 1635329

URL: http://svn.apache.org/r1635329
Log:
SOLR-6248: Changing the format of mlt query parser

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/MLTQParserPlugin.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/SimpleMLTQParserTest.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java?rev=1635329&r1=1635328&r2=1635329&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java Wed
Oct 29 23:10:17 2014
@@ -28,6 +28,7 @@ import org.apache.solr.request.SolrQuery
 import org.apache.solr.request.SolrQueryRequestBase;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.search.QParser;
+import org.apache.solr.search.QueryParsing;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -42,7 +43,7 @@ public class CloudMLTQParser extends QPa
   }
 
   public Query parse() {
-    String id = localParams.get("id");
+    String id = localParams.get(QueryParsing.V);
     // Do a Real Time Get for the document
     SolrDocument doc = getDocument(id);
     

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/MLTQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/MLTQParserPlugin.java?rev=1635329&r1=1635328&r2=1635329&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/MLTQParserPlugin.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/MLTQParserPlugin.java Wed
Oct 29 23:10:17 2014
@@ -23,7 +23,7 @@ import org.apache.solr.search.QParser;
 import org.apache.solr.search.QParserPlugin;
 
 /**
- * Usage: {!mlt id=uniqueId qf=queryField1,queryField2}
+ * Usage: {!mlt qf=queryField1,queryField2}uniqueId
  */
 public class MLTQParserPlugin extends QParserPlugin {
   public static final String NAME = "mlt";

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java?rev=1635329&r1=1635328&r2=1635329&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java Wed
Oct 29 23:10:17 2014
@@ -29,6 +29,7 @@ import org.apache.solr.common.params.Sol
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.QParser;
+import org.apache.solr.search.QueryParsing;
 import org.apache.solr.search.SolrIndexSearcher;
 
 import java.io.IOException;
@@ -45,7 +46,7 @@ public class SimpleMLTQParser extends QP
   public Query parse() {
 
     String defaultField = req.getSchema().getUniqueKeyField().getName();
-    String uniqueValue = localParams.get("id");
+    String uniqueValue = localParams.get(QueryParsing.V);
     String[] qf = localParams.getParams("qf");
 
     SolrIndexSearcher searcher = req.getSearcher();

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java?rev=1635329&r1=1635328&r2=1635329&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java Wed
Oct 29 23:10:17 2014
@@ -842,14 +842,12 @@ public class QueryEqualityTest extends S
   public void testQueryMLT() throws Exception {
     assertU(adoc("id", "1", "lowerfilt", "sample data"));
     assertU(commit());
-    SolrQueryRequest req = req("qf","lowerfilt","id","1");
     try {
-      assertQueryEquals("mlt", req,
-          "{!mlt qf=lowerfilt id=1}");
+      assertQueryEquals("mlt", "{!mlt qf=lowerfilt}1",
+          "{!mlt qf=lowerfilt v=1}");
     } finally {
       delQ("*:*");
       assertU(commit());
-      req.close();
     }
   }
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java?rev=1635329&r1=1635328&r2=1635329&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java
Wed Oct 29 23:10:17 2014
@@ -82,7 +82,7 @@ public class CloudMLTQParserTest extends
 
     ModifiableSolrParams params = new ModifiableSolrParams();
 
-    params.set(CommonParams.Q, "{!mlt id=17 qf=lowerfilt}");
+    params.set(CommonParams.Q, "{!mlt qf=lowerfilt}17");
     QueryResponse queryResponse = cloudClient.query(params);
     SolrDocumentList solrDocuments = queryResponse.getResults();
     int[] expectedIds = new int[]{17, 13, 14, 20, 22, 15, 16, 24, 18, 23};
@@ -94,7 +94,7 @@ public class CloudMLTQParserTest extends
     assertArrayEquals(expectedIds, actualIds);
     
     params = new ModifiableSolrParams();
-    params.set(CommonParams.Q, "{!mlt id=3 qf=lowerfilt}");
+    params.set(CommonParams.Q, "{!mlt qf=lowerfilt}3");
     queryResponse = queryServer(params);
     solrDocuments = queryResponse.getResults();
     expectedIds = new int[]{3, 27, 26, 28};
@@ -106,7 +106,7 @@ public class CloudMLTQParserTest extends
     assertArrayEquals(expectedIds, actualIds);
 
     params = new ModifiableSolrParams();
-    params.set(CommonParams.Q, "{!mlt id=20 qf=lowerfilt}");
+    params.set(CommonParams.Q, "{!mlt qf=lowerfilt}20");
     params.set("debug" , "query");
     queryResponse = queryServer(params);
     solrDocuments = queryResponse.getResults();

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/SimpleMLTQParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/SimpleMLTQParserTest.java?rev=1635329&r1=1635328&r2=1635329&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/SimpleMLTQParserTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/mlt/SimpleMLTQParserTest.java
Wed Oct 29 23:10:17 2014
@@ -67,7 +67,7 @@ public class SimpleMLTQParserTest extend
 
 
     ModifiableSolrParams params = new ModifiableSolrParams();
-    params.set(CommonParams.Q, "{!mlt id=17 qf=lowerfilt}");
+    params.set(CommonParams.Q, "{!mlt qf=lowerfilt}17");
     assertQ(req(params),
         "//result/doc[1]/int[@name='id'][.='17']",
         "//result/doc[2]/int[@name='id'][.='13']",



Mime
View raw message