annotate doc/_build/html/_static/searchtools.js @ 2:4ced8f116509 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
author yating-l
date Tue, 22 Nov 2016 17:13:18 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
1 /*
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
2 * searchtools.js_t
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
3 * ~~~~~~~~~~~~~~~~
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
4 *
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
5 * Sphinx JavaScript utilities for the full-text search.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
6 *
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
7 * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
8 * :license: BSD, see LICENSE for details.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
9 *
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
10 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
11
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
12
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
13 /* Non-minified version JS is _stemmer.js if file is provided */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
14 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
15 * Porter Stemmer
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
16 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
17 var Stemmer = function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
18
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
19 var step2list = {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
20 ational: 'ate',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
21 tional: 'tion',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
22 enci: 'ence',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
23 anci: 'ance',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
24 izer: 'ize',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
25 bli: 'ble',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
26 alli: 'al',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
27 entli: 'ent',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
28 eli: 'e',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
29 ousli: 'ous',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
30 ization: 'ize',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
31 ation: 'ate',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
32 ator: 'ate',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
33 alism: 'al',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
34 iveness: 'ive',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
35 fulness: 'ful',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
36 ousness: 'ous',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
37 aliti: 'al',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
38 iviti: 'ive',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
39 biliti: 'ble',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
40 logi: 'log'
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
41 };
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
42
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
43 var step3list = {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
44 icate: 'ic',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
45 ative: '',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
46 alize: 'al',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
47 iciti: 'ic',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
48 ical: 'ic',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
49 ful: '',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
50 ness: ''
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
51 };
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
52
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
53 var c = "[^aeiou]"; // consonant
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
54 var v = "[aeiouy]"; // vowel
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
55 var C = c + "[^aeiouy]*"; // consonant sequence
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
56 var V = v + "[aeiou]*"; // vowel sequence
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
57
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
58 var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
59 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
60 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
61 var s_v = "^(" + C + ")?" + v; // vowel in stem
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
62
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
63 this.stemWord = function (w) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
64 var stem;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
65 var suffix;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
66 var firstch;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
67 var origword = w;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
68
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
69 if (w.length < 3)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
70 return w;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
71
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
72 var re;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
73 var re2;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
74 var re3;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
75 var re4;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
76
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
77 firstch = w.substr(0,1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
78 if (firstch == "y")
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
79 w = firstch.toUpperCase() + w.substr(1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
80
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
81 // Step 1a
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
82 re = /^(.+?)(ss|i)es$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
83 re2 = /^(.+?)([^s])s$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
84
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
85 if (re.test(w))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
86 w = w.replace(re,"$1$2");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
87 else if (re2.test(w))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
88 w = w.replace(re2,"$1$2");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
89
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
90 // Step 1b
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
91 re = /^(.+?)eed$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
92 re2 = /^(.+?)(ed|ing)$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
93 if (re.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
94 var fp = re.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
95 re = new RegExp(mgr0);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
96 if (re.test(fp[1])) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
97 re = /.$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
98 w = w.replace(re,"");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
99 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
100 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
101 else if (re2.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
102 var fp = re2.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
103 stem = fp[1];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
104 re2 = new RegExp(s_v);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
105 if (re2.test(stem)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
106 w = stem;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
107 re2 = /(at|bl|iz)$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
108 re3 = new RegExp("([^aeiouylsz])\\1$");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
109 re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
110 if (re2.test(w))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
111 w = w + "e";
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
112 else if (re3.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
113 re = /.$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
114 w = w.replace(re,"");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
115 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
116 else if (re4.test(w))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
117 w = w + "e";
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
118 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
119 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
120
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
121 // Step 1c
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
122 re = /^(.+?)y$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
123 if (re.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
124 var fp = re.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
125 stem = fp[1];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
126 re = new RegExp(s_v);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
127 if (re.test(stem))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
128 w = stem + "i";
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
129 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
130
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
131 // Step 2
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
132 re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
133 if (re.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
134 var fp = re.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
135 stem = fp[1];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
136 suffix = fp[2];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
137 re = new RegExp(mgr0);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
138 if (re.test(stem))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
139 w = stem + step2list[suffix];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
140 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
141
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
142 // Step 3
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
143 re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
144 if (re.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
145 var fp = re.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
146 stem = fp[1];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
147 suffix = fp[2];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
148 re = new RegExp(mgr0);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
149 if (re.test(stem))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
150 w = stem + step3list[suffix];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
151 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
152
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
153 // Step 4
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
154 re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
155 re2 = /^(.+?)(s|t)(ion)$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
156 if (re.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
157 var fp = re.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
158 stem = fp[1];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
159 re = new RegExp(mgr1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
160 if (re.test(stem))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
161 w = stem;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
162 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
163 else if (re2.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
164 var fp = re2.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
165 stem = fp[1] + fp[2];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
166 re2 = new RegExp(mgr1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
167 if (re2.test(stem))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
168 w = stem;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
169 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
170
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
171 // Step 5
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
172 re = /^(.+?)e$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
173 if (re.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
174 var fp = re.exec(w);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
175 stem = fp[1];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
176 re = new RegExp(mgr1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
177 re2 = new RegExp(meq1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
178 re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
179 if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
180 w = stem;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
181 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
182 re = /ll$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
183 re2 = new RegExp(mgr1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
184 if (re.test(w) && re2.test(w)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
185 re = /.$/;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
186 w = w.replace(re,"");
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
187 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
188
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
189 // and turn initial Y back to y
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
190 if (firstch == "y")
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
191 w = firstch.toLowerCase() + w.substr(1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
192 return w;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
193 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
194 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
195
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
196
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
197
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
198 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
199 * Simple result scoring code.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
200 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
201 var Scorer = {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
202 // Implement the following function to further tweak the score for each result
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
203 // The function takes a result array [filename, title, anchor, descr, score]
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
204 // and returns the new score.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
205 /*
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
206 score: function(result) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
207 return result[4];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
208 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
209 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
210
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
211 // query matches the full name of an object
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
212 objNameMatch: 11,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
213 // or matches in the last dotted part of the object name
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
214 objPartialMatch: 6,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
215 // Additive scores depending on the priority of the object
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
216 objPrio: {0: 15, // used to be importantResults
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
217 1: 5, // used to be objectResults
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
218 2: -5}, // used to be unimportantResults
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
219 // Used when the priority is not in the mapping.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
220 objPrioDefault: 0,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
221
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
222 // query found in title
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
223 title: 15,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
224 // query found in terms
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
225 term: 5
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
226 };
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
227
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
228
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
229 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
230 * Search Module
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
231 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
232 var Search = {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
233
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
234 _index : null,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
235 _queued_query : null,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
236 _pulse_status : -1,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
237
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
238 init : function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
239 var params = $.getQueryParameters();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
240 if (params.q) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
241 var query = params.q[0];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
242 $('input[name="q"]')[0].value = query;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
243 this.performSearch(query);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
244 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
245 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
246
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
247 loadIndex : function(url) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
248 $.ajax({type: "GET", url: url, data: null,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
249 dataType: "script", cache: true,
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
250 complete: function(jqxhr, textstatus) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
251 if (textstatus != "success") {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
252 document.getElementById("searchindexloader").src = url;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
253 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
254 }});
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
255 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
256
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
257 setIndex : function(index) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
258 var q;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
259 this._index = index;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
260 if ((q = this._queued_query) !== null) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
261 this._queued_query = null;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
262 Search.query(q);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
263 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
264 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
265
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
266 hasIndex : function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
267 return this._index !== null;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
268 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
269
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
270 deferQuery : function(query) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
271 this._queued_query = query;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
272 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
273
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
274 stopPulse : function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
275 this._pulse_status = 0;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
276 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
277
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
278 startPulse : function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
279 if (this._pulse_status >= 0)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
280 return;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
281 function pulse() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
282 var i;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
283 Search._pulse_status = (Search._pulse_status + 1) % 4;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
284 var dotString = '';
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
285 for (i = 0; i < Search._pulse_status; i++)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
286 dotString += '.';
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
287 Search.dots.text(dotString);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
288 if (Search._pulse_status > -1)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
289 window.setTimeout(pulse, 500);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
290 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
291 pulse();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
292 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
293
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
294 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
295 * perform a search for something (or wait until index is loaded)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
296 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
297 performSearch : function(query) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
298 // create the required interface elements
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
299 this.out = $('#search-results');
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
300 this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
301 this.dots = $('<span></span>').appendTo(this.title);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
302 this.status = $('<p style="display: none"></p>').appendTo(this.out);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
303 this.output = $('<ul class="search"/>').appendTo(this.out);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
304
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
305 $('#search-progress').text(_('Preparing search...'));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
306 this.startPulse();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
307
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
308 // index already loaded, the browser was quick!
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
309 if (this.hasIndex())
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
310 this.query(query);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
311 else
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
312 this.deferQuery(query);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
313 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
314
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
315 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
316 * execute search (requires search index to be loaded)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
317 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
318 query : function(query) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
319 var i;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
320 var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
321
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
322 // stem the searchterms and add them to the correct list
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
323 var stemmer = new Stemmer();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
324 var searchterms = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
325 var excluded = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
326 var hlterms = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
327 var tmp = query.split(/\W+/);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
328 var objectterms = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
329 for (i = 0; i < tmp.length; i++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
330 if (tmp[i] !== "") {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
331 objectterms.push(tmp[i].toLowerCase());
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
332 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
333
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
334 if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
335 tmp[i] === "") {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
336 // skip this "word"
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
337 continue;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
338 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
339 // stem the word
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
340 var word = stemmer.stemWord(tmp[i].toLowerCase());
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
341 var toAppend;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
342 // select the correct list
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
343 if (word[0] == '-') {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
344 toAppend = excluded;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
345 word = word.substr(1);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
346 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
347 else {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
348 toAppend = searchterms;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
349 hlterms.push(tmp[i].toLowerCase());
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
350 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
351 // only add if not already in the list
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
352 if (!$u.contains(toAppend, word))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
353 toAppend.push(word);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
354 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
355 var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
356
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
357 // console.debug('SEARCH: searching for:');
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
358 // console.info('required: ', searchterms);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
359 // console.info('excluded: ', excluded);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
360
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
361 // prepare search
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
362 var terms = this._index.terms;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
363 var titleterms = this._index.titleterms;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
364
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
365 // array of [filename, title, anchor, descr, score]
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
366 var results = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
367 $('#search-progress').empty();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
368
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
369 // lookup as object
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
370 for (i = 0; i < objectterms.length; i++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
371 var others = [].concat(objectterms.slice(0, i),
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
372 objectterms.slice(i+1, objectterms.length));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
373 results = results.concat(this.performObjectSearch(objectterms[i], others));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
374 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
375
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
376 // lookup as search terms in fulltext
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
377 results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
378
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
379 // let the scorer override scores with a custom scoring function
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
380 if (Scorer.score) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
381 for (i = 0; i < results.length; i++)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
382 results[i][4] = Scorer.score(results[i]);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
383 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
384
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
385 // now sort the results by score (in opposite order of appearance, since the
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
386 // display function below uses pop() to retrieve items) and then
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
387 // alphabetically
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
388 results.sort(function(a, b) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
389 var left = a[4];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
390 var right = b[4];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
391 if (left > right) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
392 return 1;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
393 } else if (left < right) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
394 return -1;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
395 } else {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
396 // same score: sort alphabetically
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
397 left = a[1].toLowerCase();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
398 right = b[1].toLowerCase();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
399 return (left > right) ? -1 : ((left < right) ? 1 : 0);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
400 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
401 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
402
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
403 // for debugging
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
404 //Search.lastresults = results.slice(); // a copy
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
405 //console.info('search results:', Search.lastresults);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
406
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
407 // print the results
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
408 var resultCount = results.length;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
409 function displayNextItem() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
410 // results left, load the summary and display it
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
411 if (results.length) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
412 var item = results.pop();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
413 var listItem = $('<li style="display:none"></li>');
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
414 if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
415 // dirhtml builder
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
416 var dirname = item[0] + '/';
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
417 if (dirname.match(/\/index\/$/)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
418 dirname = dirname.substring(0, dirname.length-6);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
419 } else if (dirname == 'index/') {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
420 dirname = '';
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
421 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
422 listItem.append($('<a/>').attr('href',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
423 DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
424 highlightstring + item[2]).html(item[1]));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
425 } else {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
426 // normal html builders
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
427 listItem.append($('<a/>').attr('href',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
428 item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
429 highlightstring + item[2]).html(item[1]));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
430 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
431 if (item[3]) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
432 listItem.append($('<span> (' + item[3] + ')</span>'));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
433 Search.output.append(listItem);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
434 listItem.slideDown(5, function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
435 displayNextItem();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
436 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
437 } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
438 $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
439 dataType: "text",
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
440 complete: function(jqxhr, textstatus) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
441 var data = jqxhr.responseText;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
442 if (data !== '' && data !== undefined) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
443 listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
444 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
445 Search.output.append(listItem);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
446 listItem.slideDown(5, function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
447 displayNextItem();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
448 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
449 }});
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
450 } else {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
451 // no source available, just display title
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
452 Search.output.append(listItem);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
453 listItem.slideDown(5, function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
454 displayNextItem();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
455 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
456 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
457 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
458 // search finished, update title and status message
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
459 else {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
460 Search.stopPulse();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
461 Search.title.text(_('Search Results'));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
462 if (!resultCount)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
463 Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
464 else
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
465 Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
466 Search.status.fadeIn(500);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
467 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
468 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
469 displayNextItem();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
470 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
471
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
472 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
473 * search for object names
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
474 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
475 performObjectSearch : function(object, otherterms) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
476 var filenames = this._index.filenames;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
477 var objects = this._index.objects;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
478 var objnames = this._index.objnames;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
479 var titles = this._index.titles;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
480
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
481 var i;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
482 var results = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
483
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
484 for (var prefix in objects) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
485 for (var name in objects[prefix]) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
486 var fullname = (prefix ? prefix + '.' : '') + name;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
487 if (fullname.toLowerCase().indexOf(object) > -1) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
488 var score = 0;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
489 var parts = fullname.split('.');
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
490 // check for different match types: exact matches of full name or
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
491 // "last name" (i.e. last dotted part)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
492 if (fullname == object || parts[parts.length - 1] == object) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
493 score += Scorer.objNameMatch;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
494 // matches in last name
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
495 } else if (parts[parts.length - 1].indexOf(object) > -1) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
496 score += Scorer.objPartialMatch;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
497 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
498 var match = objects[prefix][name];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
499 var objname = objnames[match[1]][2];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
500 var title = titles[match[0]];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
501 // If more than one term searched for, we require other words to be
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
502 // found in the name/title/description
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
503 if (otherterms.length > 0) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
504 var haystack = (prefix + ' ' + name + ' ' +
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
505 objname + ' ' + title).toLowerCase();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
506 var allfound = true;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
507 for (i = 0; i < otherterms.length; i++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
508 if (haystack.indexOf(otherterms[i]) == -1) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
509 allfound = false;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
510 break;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
511 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
512 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
513 if (!allfound) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
514 continue;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
515 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
516 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
517 var descr = objname + _(', in ') + title;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
518
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
519 var anchor = match[3];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
520 if (anchor === '')
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
521 anchor = fullname;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
522 else if (anchor == '-')
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
523 anchor = objnames[match[1]][1] + '-' + fullname;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
524 // add custom score for some objects according to scorer
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
525 if (Scorer.objPrio.hasOwnProperty(match[2])) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
526 score += Scorer.objPrio[match[2]];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
527 } else {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
528 score += Scorer.objPrioDefault;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
529 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
530 results.push([filenames[match[0]], fullname, '#'+anchor, descr, score]);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
531 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
532 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
533 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
534
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
535 return results;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
536 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
537
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
538 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
539 * search for full-text terms in the index
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
540 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
541 performTermsSearch : function(searchterms, excluded, terms, titleterms) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
542 var filenames = this._index.filenames;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
543 var titles = this._index.titles;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
544
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
545 var i, j, file;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
546 var fileMap = {};
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
547 var scoreMap = {};
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
548 var results = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
549
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
550 // perform the search on the required terms
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
551 for (i = 0; i < searchterms.length; i++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
552 var word = searchterms[i];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
553 var files = [];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
554 var _o = [
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
555 {files: terms[word], score: Scorer.term},
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
556 {files: titleterms[word], score: Scorer.title}
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
557 ];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
558
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
559 // no match but word was a required one
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
560 if ($u.every(_o, function(o){return o.files === undefined;})) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
561 break;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
562 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
563 // found search word in contents
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
564 $u.each(_o, function(o) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
565 var _files = o.files;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
566 if (_files === undefined)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
567 return
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
568
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
569 if (_files.length === undefined)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
570 _files = [_files];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
571 files = files.concat(_files);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
572
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
573 // set score for the word in each file to Scorer.term
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
574 for (j = 0; j < _files.length; j++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
575 file = _files[j];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
576 if (!(file in scoreMap))
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
577 scoreMap[file] = {}
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
578 scoreMap[file][word] = o.score;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
579 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
580 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
581
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
582 // create the mapping
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
583 for (j = 0; j < files.length; j++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
584 file = files[j];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
585 if (file in fileMap)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
586 fileMap[file].push(word);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
587 else
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
588 fileMap[file] = [word];
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
589 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
590 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
591
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
592 // now check if the files don't contain excluded terms
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
593 for (file in fileMap) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
594 var valid = true;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
595
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
596 // check if all requirements are matched
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
597 if (fileMap[file].length != searchterms.length)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
598 continue;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
599
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
600 // ensure that none of the excluded terms is in the search result
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
601 for (i = 0; i < excluded.length; i++) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
602 if (terms[excluded[i]] == file ||
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
603 titleterms[excluded[i]] == file ||
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
604 $u.contains(terms[excluded[i]] || [], file) ||
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
605 $u.contains(titleterms[excluded[i]] || [], file)) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
606 valid = false;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
607 break;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
608 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
609 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
610
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
611 // if we have still a valid result we can add it to the result list
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
612 if (valid) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
613 // select one (max) score for the file.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
614 // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
615 var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
616 results.push([filenames[file], titles[file], '', null, score]);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
617 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
618 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
619 return results;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
620 },
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
621
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
622 /**
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
623 * helper function to return a node containing the
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
624 * search summary for a given text. keywords is a list
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
625 * of stemmed words, hlwords is the list of normal, unstemmed
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
626 * words. the first one is used to find the occurrence, the
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
627 * latter for highlighting it.
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
628 */
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
629 makeSearchSummary : function(text, keywords, hlwords) {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
630 var textLower = text.toLowerCase();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
631 var start = 0;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
632 $.each(keywords, function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
633 var i = textLower.indexOf(this.toLowerCase());
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
634 if (i > -1)
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
635 start = i;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
636 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
637 start = Math.max(start - 120, 0);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
638 var excerpt = ((start > 0) ? '...' : '') +
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
639 $.trim(text.substr(start, 240)) +
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
640 ((start + 240 - text.length) ? '...' : '');
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
641 var rv = $('<div class="context"></div>').text(excerpt);
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
642 $.each(hlwords, function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
643 rv = rv.highlightText(this, 'highlighted');
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
644 });
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
645 return rv;
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
646 }
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
647 };
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
648
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
649 $(document).ready(function() {
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
650 Search.init();
4ced8f116509 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 23b12dd763c0235674988ebdf6a258afd1ad629a-dirty
yating-l
parents:
diff changeset
651 });