Skip to content

Apache Lucene open-source search software

SOLR-5019: don't modify original filter list

Yonik Seeley5b257ac4df7b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 437b95424da..a9e44c07e36 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -265,6 +265,10 @@ Bug Fixes
* SOLR-4978: Time is stripped from datetime column when imported into Solr date field
if convertType=true. (Bill Au, shalin)
+* SOLR-5019: spurious ConcurrentModificationException when spell check component
+ was in use with filters. (yonik)
+
+
Optimizations
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
index f2d685fba4a..cdd5b2d3c6b 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
@@ -152,9 +152,8 @@ public class QueryComponent extends SearchComponent
String[] fqs = req.getParams().getParams(CommonParams.FQ);
if (fqs!=null && fqs.length!=0) {
List<Query> filters = rb.getFilters();
- if (filters==null) {
- filters = new ArrayList<Query>(fqs.length);
- }
+ // if filters already exists, make a copy instead of modifying the original
+ filters = filters == null ? new ArrayList<Query>(fqs.length) : new ArrayList<Query>(filters);
for (String fq : fqs) {
if (fq != null && fq.trim().length()!=0) {
QParser fqp = QParser.getParser(fq, null, req);