You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/07/26 04:27:59 UTC
svn commit: r1507180 - in /lucene/dev/branches/lucene5127: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java
Author: rmuir
Date: Fri Jul 26 02:27:58 2013
New Revision: 1507180
URL: http://svn.apache.org/r1507180
Log:
merge trunk
Modified:
lucene/dev/branches/lucene5127/ (props changed)
lucene/dev/branches/lucene5127/solr/ (props changed)
lucene/dev/branches/lucene5127/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/lucene5127/solr/core/ (props changed)
lucene/dev/branches/lucene5127/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
lucene/dev/branches/lucene5127/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java
Modified: lucene/dev/branches/lucene5127/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5127/solr/CHANGES.txt?rev=1507180&r1=1507179&r2=1507180&view=diff
==============================================================================
--- lucene/dev/branches/lucene5127/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene5127/solr/CHANGES.txt Fri Jul 26 02:27:58 2013
@@ -69,6 +69,10 @@ Bug Fixes
* SOLR-3633 - web UI reports an error if CoreAdminHandler says there are no
SolrCores (steffkes)
+
+* SOLR-4489 - SpellCheckComponent can throw StringIndexOutOfBoundsException
+ when generating collations involving multiple word-break corrections.
+ (James Dyer)
Optimizations
----------------------
Modified: lucene/dev/branches/lucene5127/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5127/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java?rev=1507180&r1=1507179&r2=1507180&view=diff
==============================================================================
--- lucene/dev/branches/lucene5127/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java (original)
+++ lucene/dev/branches/lucene5127/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java Fri Jul 26 02:27:58 2013
@@ -202,7 +202,7 @@ public class SpellCheckCollator {
//then be sure all of the new words have the same optional/required/prohibited status in the query.
while(indexOfSpace>-1 && indexOfSpace<corr.length()-1) {
addParenthesis = true;
- char previousChar = tok.startOffset()>0 ? collation.charAt(tok.startOffset()-1) : ' ';
+ char previousChar = tok.startOffset()>0 ? origQuery.charAt(tok.startOffset()-1) : ' ';
if(previousChar=='-' || previousChar=='+') {
corrSb.insert(indexOfSpace + bump, previousChar);
if(requiredOrProhibited==null) {
Modified: lucene/dev/branches/lucene5127/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5127/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java?rev=1507180&r1=1507179&r2=1507180&view=diff
==============================================================================
--- lucene/dev/branches/lucene5127/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java (original)
+++ lucene/dev/branches/lucene5127/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java Fri Jul 26 02:27:58 2013
@@ -44,6 +44,7 @@ public class WordBreakSolrSpellCheckerTe
assertNull(h.validateUpdate(adoc("id", "4", "lowerfilt", "printable in pointable paint able")));
assertNull(h.validateUpdate(adoc("id", "5", "lowerfilt", "printable in puntable paint able ")));
assertNull(h.validateUpdate(adoc("id", "6", "lowerfilt", "paint able in pintable plantable")));
+ assertNull(h.validateUpdate(adoc("id", "7", "lowerfilt", "zxcvqwtp fg hj")));
assertNull(h.validateUpdate(commit()));
//docfreq=7: in
//docfreq=5: able
@@ -277,6 +278,21 @@ public class WordBreakSolrSpellCheckerTe
SpellCheckComponent.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",
SpellCheckComponent.SPELLCHECK_MAX_COLLATIONS, "1"),
"//lst[@name='collation'][1 ]/str[@name='collationQuery']='lowerfilt:((+printable +in +puntable +plantable))'"
- );
+ );
+ assertQ(req(
+ "q", "zxcv AND qwtp AND fghj",
+ "qt", "spellCheckWithWordbreak",
+ "defType", "edismax",
+ "qf", "lowerfilt",
+ "indent", "true",
+ SpellCheckComponent.SPELLCHECK_BUILD, "true",
+ SpellCheckComponent.COMPONENT_NAME, "true",
+ SpellCheckComponent.SPELLCHECK_ACCURACY, ".75",
+ SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS, "true",
+ SpellCheckComponent.SPELLCHECK_COLLATE, "true",
+ SpellCheckComponent.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",
+ SpellCheckComponent.SPELLCHECK_MAX_COLLATIONS, "10"),
+ "//lst[@name='collation'][1 ]/str[@name='collationQuery']='zxcvqwtp AND (fg AND hj)'"
+ );
}
}