Author: yonik
Date: Tue Nov 24 05:27:00 2009
New Revision: 883586
URL: http://svn.apache.org/viewvc?rev=883586&view=rev
Log:
SOLR-1587: fl=score same as fl=*,score for distrib search
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java
lucene/solr/trunk/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
Modified: lucene/solr/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=883586&r1=883585&r2=883586&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Nov 24 05:27:00 2009
@@ -91,7 +91,9 @@
set when streaming updates, rather than using UTF-8 as the HTTP headers
indicated, leading to an encoding mismatch. (hossman, yonik)
-didn't specify the character set creating OutputStreamWriter
+* SOLR-1587: A distributed search request with fl=score, didn't match
+ the behavior of a non-distributed request since it only returned
+ the id,score fields instead of all fields in addition to score. (yonik)
Other Changes
Modified:
lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=883586&r1=883585&r2=883586&view=diff
==============================================================================
---
lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
(original)
+++
lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
Tue Nov 24 05:27:00 2009
@@ -513,10 +513,15 @@
// we already have the field sort values
sreq.params.remove(ResponseBuilder.FIELD_SORT_VALUES);
- // make sure that the id is returned for correlation
+ // make sure that the id is returned for correlation.
String fl = sreq.params.get(CommonParams.FL);
if (fl != null) {
- sreq.params.set(CommonParams.FL, fl+','+uniqueField.getName());
+ fl = fl.trim();
+ // currently, "score" is synonymous with "*,score" so
+ // don't add "id" if the fl is empty or "score" or it would change the
meaning.
+ if (fl.length()!=0 && !"score".equals(fl) && !"*".equals(fl)) {
+ sreq.params.set(CommonParams.FL, fl+','+uniqueField.getName());
+ }
}
ArrayList<String> ids = new ArrayList<String>(shardDocs.size());
Modified: lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java?rev=883586&r1=883585&r2=883586&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java
(original)
+++ lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java Tue
Nov 24 05:27:00 2009
@@ -619,6 +619,7 @@
query("q","*:*", "sort",i1+" desc");
query("q","*:*", "sort",i1+" asc");
query("q","*:*", "sort",i1+" desc", "fl","*,score");
+ query("q","*:*", "sort",tlong+" asc", "fl","score"); // test legacy
behavior - "score"=="*,score"
query("q","*:*", "sort",tlong+" desc");
handle.put("maxScore", SKIPVAL);
query("q","{!func}"+i1);// does not expect maxScore. So if it comes
,ignore it. JavaBinCodec.writeSolrDocumentList()
Modified:
lucene/solr/trunk/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=883586&r1=883585&r2=883586&view=diff
==============================================================================
---
lucene/solr/trunk/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
(original)
+++
lucene/solr/trunk/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
Tue Nov 24 05:27:00 2009
@@ -41,7 +41,9 @@
@Override
public void setUp() throws Exception
{
- System.setProperty("solr.solr.home", "../../../example/solr");
+ System.setPrope
+
+ rty("solr.solr.home", "../../../example/solr");
String path = "../../webapp/web";
server = new Server(port);