Skip to content

Commit 24d8a5f

Browse files
Fix highlighting for words
`includes()` is case sensitive
1 parent f088772 commit 24d8a5f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Resources/Public/JavaScript/PageView/Utility.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -646,16 +646,18 @@ dlfUtils.scaleToImageSize = function (features, imageObj, width, height, optOffs
646646
};
647647

648648
/**
649-
* Search a feature collection for a feature with the given coordinates
649+
* Search a feature collection for a feature with the given word in its fulltext.
650650
* @param {Array.<ol.Feature>} featureCollection
651-
* @param {string} coordinates
651+
* @param {string} word for highlighting
652652
* @returns {Array.<ol.Feature>|undefined}
653653
*/
654-
dlfUtils.searchFeatureCollectionForCoordinates = function (featureCollection, coordinates) {
654+
dlfUtils.searchFeatureCollectionForCoordinates = function (featureCollection, word) {
655655
var features = [];
656+
console.log(word);
656657
featureCollection.forEach(function (ft) {
657658
if (ft.values_.fulltext !== undefined) {
658-
if (ft.values_.fulltext.includes(coordinates)) {
659+
console.log(ft.values_.fulltext);
660+
if (ft.values_.fulltext.toLowerCase().includes(word.toLowerCase())) {
659661
features.push(ft);
660662
}
661663
}

0 commit comments

Comments
 (0)