lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jan...@apache.org
Subject svn commit: r1555039 - in /lucene/dev/branches/lucene_solr_4_6: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
Date Fri, 03 Jan 2014 09:29:58 GMT
Author: janhoy
Date: Fri Jan  3 09:29:58 2014
New Revision: 1555039

URL: http://svn.apache.org/r1555039
Log:
SOLR-5564: hl.maxAlternateFieldLength should apply to original field when fallback field does
not exist (backport)

Modified:
    lucene/dev/branches/lucene_solr_4_6/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
    lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java

Modified: lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt?rev=1555039&r1=1555038&r2=1555039&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/CHANGES.txt Fri Jan  3 09:29:58 2014
@@ -94,6 +94,9 @@ Bug Fixes
 * SOLR-5588: PeerSync doesn't count all connect failures as success.
   (Mark Miller)
 
+* SOLR-5564: hl.maxAlternateFieldLength should apply to original field when
+  fallback is attempted (janhoy)
+
 Optimizations
 ----------------------  
 

Modified: lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java?rev=1555039&r1=1555038&r2=1555039&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
(original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
Fri Jan  3 09:29:58 2014
@@ -602,6 +602,10 @@ public class DefaultSolrHighlighter exte
     String alternateField = params.getFieldParam(fieldName, HighlightParams.ALTERNATE_FIELD);
     if (alternateField != null && alternateField.length() > 0) {
       IndexableField[] docFields = doc.getFields(alternateField);
+      if (docFields.length == 0) {
+        // The alternate field did not exist, treat the original field as fallback instead
+        docFields = doc.getFields(fieldName);
+      }
       List<String> listFields = new ArrayList<String>();
       for (IndexableField field : docFields) {
         if (field.binaryValue() == null)

Modified: lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java?rev=1555039&r1=1555038&r2=1555039&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
(original)
+++ lucene/dev/branches/lucene_solr_4_6/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
Fri Jan  3 09:29:58 2014
@@ -660,6 +660,16 @@ public class HighlighterTest extends Sol
             "//lst[@name='highlighting']/lst[@name='1' and count(*)=1]",
             "//lst[@name='highlighting']/lst[@name='1']/arr[@name='t_text']/str[.='a piece
of text']"
             );
+
+    // with a non-existing alternate field + max length
+    args.put("hl.alternateField", "NonExistingField");
+    args.put("hl.maxAlternateFieldLength", "15");
+    sumLRF = h.getRequestFactory("standard", 0, 200, args);
+    assertQ("Alternate summarization",
+            sumLRF.makeRequest("tv_text:keyword"),
+            "//lst[@name='highlighting']/lst[@name='1' and count(*)=1]",
+            "//lst[@name='highlighting']/lst[@name='1']/arr[@name='t_text']/str[.='a piece
of text']"
+            );
   }
   
   @Test



Mime
View raw message