@@ -734,6 +734,18 @@ dlfViewer.prototype.createControl = function(controlName, layers) {
734734 }
735735} ;
736736
737+ /**
738+ * Forwards the search to dlfUtils.searchFeatureCollectionForWords
739+ *
740+ * @param {Array.<ol.Feature> } stringFeatures - Array of features containing text information
741+ * @param {string } value - Search term
742+ * @returns {Array.<ol.Feature>|undefined } Array of OpenLayers features containing found words
743+ * @see dlfUtils.searchFeatureCollectionForWords
744+ */
745+ dlfViewer . prototype . searchFeatures = function ( stringFeatures , value ) {
746+ return dlfUtils . searchFeatureCollectionForWords ( stringFeatures , value ) ;
747+ } ;
748+
737749/**
738750 * Displays highlight words
739751 */
@@ -786,23 +798,23 @@ dlfViewer.prototype.displayHighlightWord = function(highlightWords = null) {
786798 }
787799
788800 if ( this . highlightWords !== null ) {
789- var self = this ;
790- var values = decodeURIComponent ( this . highlightWords ) . split ( ';' ) ;
801+ const self = this ;
802+ const values = decodeURIComponent ( this . highlightWords ) . split ( ';' ) ;
791803
792804 $ . when . apply ( $ , this . fulltextsLoaded_ )
793- . done ( function ( fulltextData , fulltextDataImageTwo ) {
794- var stringFeatures = [ ] ;
805+ . done ( ( fulltextData , fulltextDataImageTwo ) => {
806+ const stringFeatures = [ ] ;
795807
796- [ fulltextData , fulltextDataImageTwo ] . forEach ( function ( data ) {
808+ [ fulltextData , fulltextDataImageTwo ] . forEach ( data => {
797809 if ( data !== undefined ) {
798810 Array . prototype . push . apply ( stringFeatures , data . getStringFeatures ( ) ) ;
799811 }
800812 } ) ;
801813
802- values . forEach ( function ( value ) {
803- var features = dlfUtils . searchFeatureCollectionForCoordinates ( stringFeatures , value ) ;
814+ values . forEach ( ( value ) => {
815+ const features = this . searchFeatures ( stringFeatures , value ) ;
804816 if ( features !== undefined ) {
805- for ( var i = 0 ; i < features . length ; i ++ ) {
817+ for ( let i = 0 ; i < features . length ; i ++ ) {
806818 self . highlightLayer . getSource ( ) . addFeatures ( [ features [ i ] ] ) ;
807819 }
808820 }
0 commit comments