SOLR-2942: ClassCastException when passing non-textual field for clustering

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1212495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stanisław Osiński 2011-12-09 16:04:58 +00:00
parent 97777fc0ec
commit cefa85954d
2 changed files with 5 additions and 3 deletions

View File

@ -32,6 +32,9 @@ $Id$
* SOLR-2941: NullPointerException on clustering component initialization
when schema does not have a unique key field (Stanislaw Osinski).
* SOLR-2942: ClassCastException when passing non-textual fields for
clustering (Stanislaw Osinski).
================== Release 3.5.0 ==================
(No Changes)

View File

@ -69,7 +69,6 @@ import org.carrot2.util.resource.ResourceLookup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@ -430,7 +429,7 @@ public class CarrotClusteringEngine extends SearchClusteringEngine {
// Create a Carrot2 document
Document carrotDocument = new Document(getConcatenated(sdoc, titleFieldSpec),
snippet, (String)sdoc.getFieldValue(urlField));
snippet, ObjectUtils.toString(sdoc.getFieldValue(urlField), ""));
// Store Solr id of the document, we need it to map document instances
// found in clusters back to identifiers.
@ -510,7 +509,7 @@ public class CarrotClusteringEngine extends SearchClusteringEngine {
// Join multiple values with a period so that Carrot2 does not pick up
// phrases that cross field value boundaries (in most cases it would
// create useless phrases).
result.append((String)ite.next()).append(" . ");
result.append(ObjectUtils.toString(ite.next())).append(" . ");
}
}
return result.toString().trim();