Text filter was throwing an exception if the column went away (which happened when the column got split).
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1464 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
336a773069
commit
69c338c728
@ -15,6 +15,7 @@ import com.google.refine.browsing.filters.AnyRowRecordFilter;
|
|||||||
import com.google.refine.browsing.filters.ExpressionStringComparisonRowFilter;
|
import com.google.refine.browsing.filters.ExpressionStringComparisonRowFilter;
|
||||||
import com.google.refine.expr.Evaluable;
|
import com.google.refine.expr.Evaluable;
|
||||||
import com.google.refine.grel.ast.VariableExpr;
|
import com.google.refine.grel.ast.VariableExpr;
|
||||||
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
|
|
||||||
public class TextSearchFacet implements Facet {
|
public class TextSearchFacet implements Facet {
|
||||||
@ -54,7 +55,8 @@ public class TextSearchFacet implements Facet {
|
|||||||
_name = o.getString("name");
|
_name = o.getString("name");
|
||||||
_columnName = o.getString("columnName");
|
_columnName = o.getString("columnName");
|
||||||
|
|
||||||
_cellIndex = project.columnModel.getColumnByName(_columnName).getCellIndex();
|
Column column = project.columnModel.getColumnByName(_columnName);
|
||||||
|
_cellIndex = column != null ? column.getCellIndex() : -1;
|
||||||
|
|
||||||
if (!o.isNull("query")) {
|
if (!o.isNull("query")) {
|
||||||
_query = o.getString("query");
|
_query = o.getString("query");
|
||||||
@ -79,7 +81,7 @@ public class TextSearchFacet implements Facet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RowFilter getRowFilter(Project project) {
|
public RowFilter getRowFilter(Project project) {
|
||||||
if (_query == null || _query.length() == 0) {
|
if (_query == null || _query.length() == 0 || _cellIndex < 0) {
|
||||||
return null;
|
return null;
|
||||||
} else if ("regex".equals(_mode) && _pattern == null) {
|
} else if ("regex".equals(_mode) && _pattern == null) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user