Changeset 6308


Ignore:
Timestamp:
06/18/15 08:23:38 (9 years ago)
Author:
Twan Goosen
Message:

exclude search keywords (and, or, not) from highlighting
refs #762

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo-web-app/src/main/js/eu/clarin/cmdi/vlo/wicket/pages/searchhi.js

    r5261 r6308  
    77/* Modified 20120112 to use the URL instead of referrer */
    88/* Modified 20140522 <twan@clarin.eu> replaced unescape() with decodeURIComponent() */
     9/* Modified 20150618 <twan@clarin.eu> added list of terms to exclude from highlighting */
     10
     11// list of words to exclude from highlighting (must be lower case)
     12var excludeWords = [
     13    "and",
     14    "or",
     15    "not"
     16];
    917
    1018searchhi = {
     
    7684        var words = wordstring.split(/\s+/);
    7785        for (w = 0; w < words.length; w++) {
    78             searchhi.highlightWord(document.getElementsByTagName("body")[0], words[w]);
     86            if(excludeWords.indexOf(words[w].toLowerCase()) < 0) {
     87                searchhi.highlightWord(document.getElementsByTagName("body")[0], words[w]);
     88
     89            }
    7990        }
    8091        if (searchhi.found === 0) {
Note: See TracChangeset for help on using the changeset viewer.