@@ -439,6 +439,18 @@ dlfViewer.prototype.createControl = function(controlName, layers) {
439439 }
440440} ;
441441
442+ /**
443+ * Forwards the search to dlfUtils.searchFeatureCollectionForWords
444+ *
445+ * @param {Array.<ol.Feature> } stringFeatures - Array of features containing text information
446+ * @param {string } value - Search term
447+ * @returns {Array.<ol.Feature>|undefined } Array of OpenLayers features containing found words
448+ * @see dlfUtils.searchFeatureCollectionForWords
449+ */
450+ dlfViewer . prototype . searchFeatures = function ( stringFeatures , value ) {
451+ return dlfUtils . searchFeatureCollectionForWords ( stringFeatures , value ) ;
452+ } ;
453+
442454/**
443455 * Displays highlight words
444456 */
@@ -491,23 +503,23 @@ dlfViewer.prototype.displayHighlightWord = function(highlightWords = null) {
491503 }
492504
493505 if ( this . highlightWords !== null ) {
494- var self = this ;
495- var values = decodeURIComponent ( this . highlightWords ) . split ( ';' ) ;
506+ const self = this ;
507+ const values = decodeURIComponent ( this . highlightWords ) . split ( ';' ) ;
496508
497509 $ . when . apply ( $ , this . fulltextsLoaded_ )
498- . done ( function ( fulltextData , fulltextDataImageTwo ) {
499- var stringFeatures = [ ] ;
510+ . done ( ( fulltextData , fulltextDataImageTwo ) => {
511+ const stringFeatures = [ ] ;
500512
501- [ fulltextData , fulltextDataImageTwo ] . forEach ( function ( data ) {
513+ [ fulltextData , fulltextDataImageTwo ] . forEach ( data => {
502514 if ( data !== undefined ) {
503515 Array . prototype . push . apply ( stringFeatures , data . getStringFeatures ( ) ) ;
504516 }
505517 } ) ;
506518
507- values . forEach ( function ( value ) {
508- var features = dlfUtils . searchFeatureCollectionForCoordinates ( stringFeatures , value ) ;
519+ values . forEach ( ( value ) => {
520+ const features = this . searchFeatures ( stringFeatures , value ) ;
509521 if ( features !== undefined ) {
510- for ( var i = 0 ; i < features . length ; i ++ ) {
522+ for ( let i = 0 ; i < features . length ; i ++ ) {
511523 self . highlightLayer . getSource ( ) . addFeatures ( [ features [ i ] ] ) ;
512524 }
513525 }
0 commit comments