Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

include shortname in search terms

Jason Kent246c350d185a
diff --git a/web/js/modules/product-picker/search-config.js b/web/js/modules/product-picker/search-config.js
index f51bfbe04..3be81560f 100644
--- a/web/js/modules/product-picker/search-config.js
+++ b/web/js/modules/product-picker/search-config.js
@@ -4,7 +4,6 @@ import {
set as lodashSet,
forEach as lodashForEach,
toLower as lodashToLower,
- includes as lodashIncludes,
} from 'lodash';
import moment from 'moment';
import { getTitles } from '../layers/selectors';
@@ -107,21 +106,22 @@ function filterSearch (layer, val, terms) {
return false;
}
- let filtered = false;
+ let isFilteredOut = false;
const names = getTitles(configRef, layer.id, projectionRef);
const title = lodashToLower(names.title);
const subtitle = lodashToLower(names.subtitle);
const tags = lodashToLower(names.tags);
const layerId = lodashToLower(layer.id);
+ const conceptIdsArray = layer.conceptIds || [];
+ const conceptIds = conceptIdsArray.map(({ value = '' }) => value.toLowerCase());
+ const shortNames = conceptIdsArray.map(({ shortName = '' }) => shortName.toLowerCase());
+ const matchItems = [title, subtitle, tags, layerId, conceptIds, shortNames];
lodashForEach(terms, (term) => {
- filtered = !lodashIncludes(title, term)
- && !lodashIncludes(subtitle, term)
- && !lodashIncludes(tags, term)
- && !lodashIncludes(layerId, term);
- if (filtered) return false;
+ isFilteredOut = matchItems.every((item) => !item.includes(term));
+ if (isFilteredOut) return false;
});
- return filtered;
+ return isFilteredOut;
}
/**