ferret 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -1
- data/bin/ferret-browser +79 -0
- data/ext/analysis.c +5 -2
- data/ext/config.h +2 -1
- data/ext/ferret.c +32 -7
- data/ext/ferret.h +1 -0
- data/ext/index.c +69 -48
- data/ext/q_boolean.c +21 -7
- data/ext/q_parser.c +203 -113
- data/ext/q_span.c +2 -1
- data/ext/r_analysis.c +14 -1
- data/ext/r_index.c +179 -0
- data/ext/r_search.c +12 -30
- data/ext/search.c +1 -0
- data/ext/search.h +4 -0
- data/ext/store.c +24 -0
- data/ext/store.h +14 -0
- data/lib/ferret/browser.rb +246 -0
- data/lib/ferret/browser/s/global.js +192 -0
- data/lib/ferret/browser/s/style.css +148 -0
- data/lib/ferret/browser/views/document/list.rhtml +49 -0
- data/lib/ferret/browser/views/document/show.rhtml +27 -0
- data/lib/ferret/browser/views/error/index.rhtml +7 -0
- data/lib/ferret/browser/views/help/index.rhtml +8 -0
- data/lib/ferret/browser/views/home/index.rhtml +29 -0
- data/lib/ferret/browser/views/layout.rhtml +22 -0
- data/lib/ferret/browser/views/term-vector/index.rhtml +4 -0
- data/lib/ferret/browser/views/term/index.rhtml +199 -0
- data/lib/ferret/browser/views/term/termdocs.rhtml +1 -0
- data/lib/ferret/browser/webrick.rb +14 -0
- data/lib/ferret/index.rb +67 -36
- data/lib/ferret_version.rb +1 -1
- data/test/unit/analysis/tc_analyzer.rb +5 -5
- data/test/unit/analysis/tc_token_stream.rb +4 -4
- data/test/unit/index/tc_index.rb +1 -1
- data/test/unit/index/tc_index_reader.rb +37 -0
- data/test/unit/search/tc_spans.rb +18 -1
- metadata +18 -5
@@ -0,0 +1,148 @@
|
|
1
|
+
body {
|
2
|
+
padding: 10px 30px;
|
3
|
+
}
|
4
|
+
ul#top-menu {
|
5
|
+
margin: 0;
|
6
|
+
padding: 0;
|
7
|
+
padding-left: 20px;
|
8
|
+
border-bottom: 1px solid #000099;
|
9
|
+
}
|
10
|
+
ul#top-menu li {
|
11
|
+
display: inline;
|
12
|
+
padding: 0px;
|
13
|
+
}
|
14
|
+
ul#top-menu li a, ul#top-menu li a:visited {
|
15
|
+
background-color: #cce6ff;
|
16
|
+
padding: 0px 5px;
|
17
|
+
border: 1px solid #000099;
|
18
|
+
text-decoration: none;
|
19
|
+
color: #000099;
|
20
|
+
font-weight: bold;
|
21
|
+
}
|
22
|
+
body#home ul#top-menu li.home a,
|
23
|
+
body#document ul#top-menu li.document a,
|
24
|
+
body#term ul#top-menu li.term a,
|
25
|
+
body#term-vector ul#top-menu li.term-vector a,
|
26
|
+
body#help ul#top-menu li.help a {
|
27
|
+
background-color: #f0f8ff;
|
28
|
+
border-bottom: 1px solid #f0f8ff;
|
29
|
+
}
|
30
|
+
div#content {
|
31
|
+
padding: 10px;
|
32
|
+
margin: 0;
|
33
|
+
background-color: #f0f8ff;
|
34
|
+
}
|
35
|
+
div.display {background-color:#fff;padding:0 5px;}
|
36
|
+
dl {
|
37
|
+
width: 51.1em;
|
38
|
+
margin: 0;
|
39
|
+
padding: 0;
|
40
|
+
}
|
41
|
+
dl dt {
|
42
|
+
width: 15em;
|
43
|
+
float: left;
|
44
|
+
margin: 0;
|
45
|
+
padding: .5em;
|
46
|
+
border-top: 1px solid #999;
|
47
|
+
font-weight: bold;
|
48
|
+
color: #cc9900;
|
49
|
+
}
|
50
|
+
/* commented backslash hack for mac-ie5 \*/
|
51
|
+
dt { clear: both; }
|
52
|
+
/* end hack */
|
53
|
+
dl dd {
|
54
|
+
float: left;
|
55
|
+
width: 34em;
|
56
|
+
margin: 0 0 0 0;
|
57
|
+
padding: .5em;
|
58
|
+
border-top: 1px solid #999;
|
59
|
+
}
|
60
|
+
hr {clear:both;border:0;}
|
61
|
+
h1, h2, h3, h4, h5, h6 {color:#cc0033;}
|
62
|
+
th {
|
63
|
+
font-weight: bold;
|
64
|
+
background-color: #cc9900;
|
65
|
+
color: white;
|
66
|
+
padding: 3px;
|
67
|
+
font-size: 12px;
|
68
|
+
}
|
69
|
+
th.small, td.small {font-size:11px;}
|
70
|
+
th, td {
|
71
|
+
border-top: 1px solid #994400;
|
72
|
+
border-left: 1px solid #994400;
|
73
|
+
}
|
74
|
+
table {
|
75
|
+
border-bottom: 1px solid #994400;
|
76
|
+
border-right: 1px solid #994400;
|
77
|
+
}
|
78
|
+
table.left-headed th {width:80px;text-align:left;}
|
79
|
+
table.left-headed td {background-color: white;text-align:right;width:120px;}
|
80
|
+
td {padding:2px 6px;color:#555;}
|
81
|
+
tr.even {background-color:#cce6ff;}
|
82
|
+
tr.odd {background-color:white;}
|
83
|
+
td.center {text-align:center}
|
84
|
+
td.right {text-align:right}
|
85
|
+
|
86
|
+
label.check {width:150px;float:left;}
|
87
|
+
pre {
|
88
|
+
border-left: solid 1px #cccccc;
|
89
|
+
border-top: solid 1px #cccccc;
|
90
|
+
border-bottom: solid 1px #cccccc;
|
91
|
+
border-right: dashed 2px #cccccc;
|
92
|
+
margin: 1em;
|
93
|
+
padding: 0.7em;
|
94
|
+
display: block;
|
95
|
+
overflow: hidden;
|
96
|
+
color: white;
|
97
|
+
background-color: black;
|
98
|
+
}
|
99
|
+
pre:hover {
|
100
|
+
overflow: visible;
|
101
|
+
border-right: solid 1px #cccccc;
|
102
|
+
width: 1000px;
|
103
|
+
}
|
104
|
+
div.nav {color:#007777;font-size:11px;}
|
105
|
+
div.nav a, div.nav a:visited {
|
106
|
+
background-color: white;
|
107
|
+
color: #007777;
|
108
|
+
padding: 2px 4px;
|
109
|
+
border: 1px solid #bbd8ef;
|
110
|
+
margin-right: 1px;
|
111
|
+
text-decoration: none;
|
112
|
+
font-size: 11px;
|
113
|
+
}
|
114
|
+
div.nav a.deleted {
|
115
|
+
background-color: #fee;
|
116
|
+
}
|
117
|
+
div.nav a.deleted:hover {
|
118
|
+
background-color: #077;
|
119
|
+
color: #fee;
|
120
|
+
}
|
121
|
+
div.nav a.disabled, div.nav a.disabled:hover {
|
122
|
+
cursor: default;
|
123
|
+
color: #ccc;
|
124
|
+
border: 1px solid #ccc;
|
125
|
+
background-color: white;
|
126
|
+
}
|
127
|
+
div.nav a:hover {
|
128
|
+
background-color: #007777;
|
129
|
+
color: white;
|
130
|
+
}
|
131
|
+
/* Auto Suggest */
|
132
|
+
div.suggestions {
|
133
|
+
-moz-box-sizing: border-box;
|
134
|
+
box-sizing: border-box;
|
135
|
+
border: 1px solid black;
|
136
|
+
position: absolute;
|
137
|
+
}
|
138
|
+
div.suggestions div {
|
139
|
+
cursor: default;
|
140
|
+
padding: 0px 3px;
|
141
|
+
background-color: white;
|
142
|
+
opacity: 0.80;
|
143
|
+
filter:alpha(opacity=80);
|
144
|
+
}
|
145
|
+
div.suggestions div.current {
|
146
|
+
background-color: #3366cc;
|
147
|
+
color: white;
|
148
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<h3>List Documents</h3>
|
2
|
+
<fieldset>
|
3
|
+
<legend>Show fields</legend>
|
4
|
+
<form method="get" action="">
|
5
|
+
<% fields = [];
|
6
|
+
field_settings = @params["field"]||{};
|
7
|
+
@reader.field_infos.each do |fi|
|
8
|
+
next unless fi.stored?
|
9
|
+
%>
|
10
|
+
<label class="check" for="field_<%= fi.name %>">
|
11
|
+
<input name="field[<%= fi.name %>]" type="checkbox" id="field_<%= fi.name %>"
|
12
|
+
<% if field_settings[fi.name.to_s] == "on"; fields << fi.name %>
|
13
|
+
checked="checked"
|
14
|
+
<% end %>
|
15
|
+
onchange="this.form.submit();" /><%= fi.name %>
|
16
|
+
</label>
|
17
|
+
<% end %>
|
18
|
+
</form>
|
19
|
+
</fieldset>
|
20
|
+
<hr/>
|
21
|
+
<%= paginate(@page, @reader.max_doc/@page_size, '/document/list/') %>
|
22
|
+
<hr/>
|
23
|
+
<table cellpadding="0" cellspacing="0">
|
24
|
+
|
25
|
+
<tr>
|
26
|
+
<th>Internal ID</th>
|
27
|
+
<% fields.each do |field| %>
|
28
|
+
<th><%= field %></th>
|
29
|
+
<% end %>
|
30
|
+
</tr>
|
31
|
+
|
32
|
+
<% even=false; (@first...@last).each do |i| %>
|
33
|
+
<% if @reader.deleted?(i) %>
|
34
|
+
<tr class="<%= (even = !even) ? 'even' : 'odd' %>">
|
35
|
+
<td colspan="<%= fields.size + 1 %>" class="center" style="color:#b00;"><%=i%> is deleted</td>
|
36
|
+
</tr>
|
37
|
+
<% else %>
|
38
|
+
<tr onclick="location.href='/document/show/<%=i%>';"
|
39
|
+
class="<%= (even = !even) ? 'even' : 'odd' %>">
|
40
|
+
<td class="left"><a href="/document/show/<%=i%>"><%= i %></a></td>
|
41
|
+
<% doc = @reader[i]; fields.each do |field| %>
|
42
|
+
<td class="small"><%= truncate(doc[field]) %></td>
|
43
|
+
<% end %>
|
44
|
+
</tr>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
</table>
|
48
|
+
<hr/>
|
49
|
+
<%= choose_document(@doc_id) %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h3>View Document</h3>
|
2
|
+
<%= choose_document(@doc_id) %>
|
3
|
+
<hr/>
|
4
|
+
<%= paginate_docs %>
|
5
|
+
<% total_length = 0 %>
|
6
|
+
<div class="display">
|
7
|
+
<% if @doc %>
|
8
|
+
<h3>Fields</h3>
|
9
|
+
<dl>
|
10
|
+
<% @doc.each_pair do |field, value| %>
|
11
|
+
<% total_length += value.length %>
|
12
|
+
<dt><%= field %></dt>
|
13
|
+
<dd>
|
14
|
+
<% if value.length > 50 %>
|
15
|
+
<pre><%= value %></pre>
|
16
|
+
<% else %>
|
17
|
+
<%= value %>
|
18
|
+
<% end %>
|
19
|
+
</dd>
|
20
|
+
<% end %>
|
21
|
+
</dl>
|
22
|
+
<hr/>
|
23
|
+
<% else %>
|
24
|
+
<p style="color:#933;">Document has been deleted</p>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
<%= (total_length > 1000) ? paginate_docs : '' %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<h3>Ferret Browser Help</h3>
|
2
|
+
<p>
|
3
|
+
At the moment there is no help for the Ferret Browser. Everything should be
|
4
|
+
fairly self explanatory. If not, you can post a question on the
|
5
|
+
<a href="http://rubyforge.org/mailman/listinfo/ferret-talk">mailing list</a>
|
6
|
+
or you can edit the
|
7
|
+
<a href="http://ferret.davebalmain.com/trac/wiki/FerretBrowser" title="Ferret Browser Home Page">FerretBrowser wiki page</a>.
|
8
|
+
</p>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h3>Index Info</h3>
|
2
|
+
<dl>
|
3
|
+
<dt>Number of Documents</dt> <dd><%= @reader.num_docs %></dd>
|
4
|
+
<dt>Maximum Document</dt> <dd><%= @reader.max_doc %></dd>
|
5
|
+
</dl>
|
6
|
+
<hr/>
|
7
|
+
<h3>Field Infos</h3>
|
8
|
+
<% field_props = [:stored?, :compressed?, :indexed?, :tokenized?, :omit_norms?, :store_term_vector?, :store_positions?, :store_offsets?, :has_norms?] %>
|
9
|
+
<table cellpadding="0" cellspacing="0">
|
10
|
+
<tr>
|
11
|
+
<th>Field Name</th>
|
12
|
+
<th class="small">Boost</th>
|
13
|
+
<% field_props.each do |prop| %>
|
14
|
+
<th class="small"><%= prop %></th>
|
15
|
+
<% end %>
|
16
|
+
</tr>
|
17
|
+
<%
|
18
|
+
even=false;
|
19
|
+
@reader.field_infos.each do |fi|
|
20
|
+
%>
|
21
|
+
<tr class="<%= (even = !even) ? 'even' : 'odd' %>">
|
22
|
+
<td><%= fi.name %></td>
|
23
|
+
<td style="text-align:right;"><%= fi.boost %></td>
|
24
|
+
<% field_props.each do |prop| %>
|
25
|
+
<td class="center"><%= tick_or_cross(fi.send(prop)) %></td>
|
26
|
+
<% end %>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
</table>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<title>Ferret-Browser:: <%= @path %></title>
|
6
|
+
<link rel="shortcut icon" type="image/x-icon" href="/s/i/favicon.ico" />
|
7
|
+
<link rel="stylesheet" type="text/css" href="/s/style.css" />
|
8
|
+
<script type="text/javascript" src="/s/global.js"></script>
|
9
|
+
</head>
|
10
|
+
<body id="<%= options[:controller] %>">
|
11
|
+
<ul id="top-menu">
|
12
|
+
<li class="home"><a href="/">Home</a></li>
|
13
|
+
<li class="document"><a href="/document">Documents</a></li>
|
14
|
+
<li class="term"><a href="/term">Terms</a></li>
|
15
|
+
<li class="term-vector"><a href="/term-vector">Term Vectors</a></li>
|
16
|
+
<li class="help"><a href="/help">Help</a></li>
|
17
|
+
</ul>
|
18
|
+
<div id="content">
|
19
|
+
<%= content %>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,199 @@
|
|
1
|
+
<h3>Terms</h3>
|
2
|
+
<form action="" method="get">
|
3
|
+
<label for="field">Choose a field:
|
4
|
+
<select id="field" name="field" onchange="location.href='/term/show/' + this.value;">
|
5
|
+
<option value="">--</option>
|
6
|
+
<% @reader.field_infos.each do |fi| next unless fi.indexed? %>
|
7
|
+
<option value="<%=fi.name%>" <%= 'selected="selected"' if @field == fi.name %>><%=fi.name%></option>
|
8
|
+
<% end %>
|
9
|
+
</select>
|
10
|
+
</label>
|
11
|
+
</form>
|
12
|
+
<hr/>
|
13
|
+
<% if @terms %>
|
14
|
+
<div style="float:left; padding-right:30px;">
|
15
|
+
<h4>Field: <%= @field %></h4>
|
16
|
+
<form action="" onsubmit="return findTerm(document.getElementById('choose-term').value);">
|
17
|
+
<input id="choose-term" type="text"/></form>
|
18
|
+
<hr/>
|
19
|
+
<div id="terms">
|
20
|
+
</div>
|
21
|
+
<hr/>
|
22
|
+
<form action="">
|
23
|
+
<input type="submit" value="Previous" onclick="return prevTerm();"/>
|
24
|
+
<input type="submit" value="Next" onclick="return nextTerm();"/><br/>
|
25
|
+
</form>
|
26
|
+
</div>
|
27
|
+
<div style="float:left; padding-right:30px;">
|
28
|
+
<h4>Documents
|
29
|
+
<input name="show-documents" type="checkbox" id="show-documents" onchange="displayDoc();"/></h4>
|
30
|
+
<div id="doc-display">
|
31
|
+
<form action="" onsubmit="return findDoc(document.getElementById('choose-doc').value);">
|
32
|
+
<input id="choose-doc" type="text"/></form>
|
33
|
+
<hr/>
|
34
|
+
<div id="documents">
|
35
|
+
</div>
|
36
|
+
<hr/>
|
37
|
+
<form action="">
|
38
|
+
<input type="submit" value="Previous" onclick="return prevDoc();"/>
|
39
|
+
<input type="submit" value="Next" onclick="return nextDoc();"/><br/>
|
40
|
+
</form>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<script type="text/javascript"><!--
|
44
|
+
function createSideHeaderedTable(content) {
|
45
|
+
var table = document.createElement("table");
|
46
|
+
table.setAttribute('cellpadding', "0");
|
47
|
+
table.setAttribute('cellspacing', "0");
|
48
|
+
table.className = "left-headed";
|
49
|
+
for (var i = 0; i < content.length; i++) {
|
50
|
+
var tr = document.createElement("tr");
|
51
|
+
var th = document.createElement("th");
|
52
|
+
th.appendChild(document.createTextNode(content[i][0]));
|
53
|
+
tr.appendChild(th);
|
54
|
+
var td = document.createElement("td");
|
55
|
+
var c = content[i][1];
|
56
|
+
td.appendChild(c instanceof Object ? c : document.createTextNode(c));
|
57
|
+
tr.appendChild(td);
|
58
|
+
table.appendChild(tr);
|
59
|
+
}
|
60
|
+
return table;
|
61
|
+
}
|
62
|
+
|
63
|
+
var terms = <%= @terms %>;
|
64
|
+
var numTerms = terms.length;
|
65
|
+
var termI = 0;
|
66
|
+
var termDiv = document.getElementById("terms");
|
67
|
+
var termChooserTxt = document.getElementById('choose-term');
|
68
|
+
|
69
|
+
var docs = null;
|
70
|
+
var numDocs = 0;
|
71
|
+
var docI = 0;
|
72
|
+
var docDiv = document.getElementById("documents");
|
73
|
+
var showDocs = document.getElementById("show-documents");
|
74
|
+
var docChooserTxt = document.getElementById('choose-doc');
|
75
|
+
var docDisplayDiv = document.getElementById('doc-display');
|
76
|
+
|
77
|
+
function getDocs() {
|
78
|
+
var req = new XMLHttpRequest();
|
79
|
+
req.open('GET', '/term/termdocs/<%=@field%>/' + terms[termI][0], true);
|
80
|
+
req.onreadystatechange = function() {
|
81
|
+
if (req.readyState == 4) {
|
82
|
+
docs = eval(req.responseText);
|
83
|
+
numDocs = docs.length;
|
84
|
+
docI = 0;
|
85
|
+
displayDoc();
|
86
|
+
}
|
87
|
+
};
|
88
|
+
req.send(/*no params*/null);
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
function displayDoc() {
|
92
|
+
if (showDocs.checked) {
|
93
|
+
docDisplayDiv.style.display = 'block';
|
94
|
+
if (docs == null) {
|
95
|
+
getDocs();
|
96
|
+
} else {
|
97
|
+
docChooserTxt.value = docs[docI][0];
|
98
|
+
var docLink = document.createElement('a');
|
99
|
+
docLink.setAttribute('href', "/document/show/" + docs[docI][0]);
|
100
|
+
docLink.appendChild(document.createTextNode(docs[docI][0]));
|
101
|
+
var table = createSideHeaderedTable([
|
102
|
+
['index', '' + (docI + 1) + ' of ' + numDocs],
|
103
|
+
['document', docLink],
|
104
|
+
['number of occurrences', docs[docI][1]],
|
105
|
+
['positions', docs[docI][2].join(',')]
|
106
|
+
]);
|
107
|
+
if (docDiv.firstChild) docDiv.replaceChild(table, docDiv.firstChild);
|
108
|
+
else docDiv.appendChild(table);
|
109
|
+
}
|
110
|
+
} else {
|
111
|
+
docDiv.innerHTML = '';
|
112
|
+
docDisplayDiv.style.display = 'none';
|
113
|
+
}
|
114
|
+
return false;
|
115
|
+
}
|
116
|
+
function nextDoc() {
|
117
|
+
if (docI < numDocs - 1) {
|
118
|
+
docI++;
|
119
|
+
displayDoc();
|
120
|
+
} else alert('No more docs. Already at the end.');
|
121
|
+
return false;
|
122
|
+
}
|
123
|
+
function prevDoc() {
|
124
|
+
if (docI > 0) {
|
125
|
+
docI -= 1;
|
126
|
+
displayDoc();
|
127
|
+
} else alert('No more docs. Already at the start.');
|
128
|
+
return false;
|
129
|
+
}
|
130
|
+
function findDoc(doc) {
|
131
|
+
if (docs && docs.length > 0) {
|
132
|
+
docI = bsearch(docs, doc, function(a, b) {return a[0] < b});
|
133
|
+
if (docI >= docs.length) docI -= 1;
|
134
|
+
displayDoc();
|
135
|
+
}
|
136
|
+
return false;
|
137
|
+
}
|
138
|
+
function displayTerm() {
|
139
|
+
docs = null;
|
140
|
+
termChooserTxt.value = terms[termI][0];
|
141
|
+
var table = createSideHeaderedTable([
|
142
|
+
['index', '' + (termI + 1) + ' of ' + numTerms],
|
143
|
+
['term', terms[termI][0]],
|
144
|
+
['number of documents', terms[termI][1]],
|
145
|
+
]);
|
146
|
+
termDiv.replaceChild(table, termDiv.firstChild);
|
147
|
+
displayDoc();
|
148
|
+
}
|
149
|
+
function nextTerm() {
|
150
|
+
if (termI < numTerms - 1) {
|
151
|
+
termI++;
|
152
|
+
displayTerm();
|
153
|
+
} else alert('No more terms. Already at the end.');
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
function prevTerm() {
|
157
|
+
if (termI > 0) {
|
158
|
+
termI -= 1;
|
159
|
+
displayTerm();
|
160
|
+
} else alert('No more terms. Already at the start.');
|
161
|
+
return false;
|
162
|
+
}
|
163
|
+
function findTerm(term) {
|
164
|
+
if (terms && terms.length > 0) {
|
165
|
+
termI = bsearch(terms, term, function(a, b) {return a[0] < b});
|
166
|
+
var match = (terms[termI]||[])[0];
|
167
|
+
if (term != match) {
|
168
|
+
alert('Term <%=@field%>:' + term + ' not found in index');
|
169
|
+
} else {
|
170
|
+
displayTerm();
|
171
|
+
}
|
172
|
+
}
|
173
|
+
return false;
|
174
|
+
}
|
175
|
+
|
176
|
+
function TermSuggestionProvider() {
|
177
|
+
}
|
178
|
+
TermSuggestionProvider.prototype.requestSuggestions = function(oAutoSuggestControl, bTypeAhead) {
|
179
|
+
var aSuggestions = new Array();
|
180
|
+
var sTextboxValue = oAutoSuggestControl.textbox.value;
|
181
|
+
|
182
|
+
if (sTextboxValue.length > 0) {
|
183
|
+
start = bsearch(terms, sTextboxValue, function(a, b) {return a[0] < b});
|
184
|
+
for (var i = start; i < terms.length
|
185
|
+
&& terms[i][0].indexOf(sTextboxValue) == 0
|
186
|
+
&& aSuggestions.length < 10; i++) {
|
187
|
+
aSuggestions.push(terms[i][0]);
|
188
|
+
}
|
189
|
+
oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
|
190
|
+
}
|
191
|
+
};
|
192
|
+
window.onload = function() {
|
193
|
+
var oTermTextbox = new AutoSuggestControl(termChooserTxt, new TermSuggestionProvider());
|
194
|
+
}
|
195
|
+
displayTerm();
|
196
|
+
//-->
|
197
|
+
</script>
|
198
|
+
<% end %>
|
199
|
+
<hr/>
|