Skip to content

Commit bbda2b6

Browse files
committed
WIP: Add dropdown to toggle collections
1 parent ec72257 commit bbda2b6

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

Diff for: _search/client/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ <h1 class="header-title">
3232
<div class="container">
3333
<div id="search-panel">
3434
<div id="search-box"></div>
35+
<div id="search-dropdown"></div>
3536
</div>
3637

3738
<div id="search-results">

Diff for: _search/client/src/app.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import TypesenseInstantSearchAdapter from "typesense-instantsearch-adapter";
44

55
const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
66
server: {
7-
apiKey: "Sjkob6WIxE5vfpVK3Dp4FYPYFjRdWfBl" , // Be sure to use the search-only-api-key
7+
apiKey: "F3vRyCOqztwtTQqk2MK3WiUHuveNczoa" , // Be sure to use the search-only-api-key
88
nodes: [
99
{
1010
host: "144.92.48.217",
@@ -24,15 +24,35 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
2424
});
2525
const searchClient = typesenseInstantsearchAdapter.searchClient;
2626

27+
/* search.addWidget(
28+
instantsearch.widgets.sortBySelector({
29+
container: '#search-panel',
30+
indicies: [
31+
{name: 'imagej-wiki', label: 'imagej-wiki'},
32+
{name: 'imagej-tutorials', label: 'imagej-tutorials'},
33+
{name: 'imagej-website', label: 'imagej-websites'}
34+
]
35+
})
36+
) */
37+
2738
const search = instantsearch({
2839
searchClient,
29-
indexName: "imagej-wiki"
40+
indexName: "imagej-tutorials"
3041
});
3142

3243
search.addWidgets([
3344
instantsearch.widgets.searchBox({
3445
container: '#search-box',
3546
}),
47+
// this is an attempt to add a dropdown selector to choose between collection options
48+
/* instantsearch.widgets.sortBySelector({
49+
container: '#search-dropdown', // I created search-dropdown in the html to try to add a place for the dropdown
50+
indicies: [
51+
{name: 'imagej-wiki', label: 'imagej-wiki'},
52+
{name: 'imagej-tutorials', label: 'imagej-tutorials'},
53+
{name: 'imagej-website', label: 'imagej-websites'}
54+
]
55+
}), */
3656
instantsearch.widgets.hits({
3757
container: '#search-hits',
3858
templates: {

Diff for: _search/server/tutorials.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def parse_java_source(path):
3232
doc['content'] = ''.join(lines)
3333
title = str(path)
3434
doc['title'] = title[title.find("tutorials/")+len("tutorials/"):]
35-
doc['icon'] = 'Java_logo.png'
35+
doc['icon'] = '../../media/java.png'
3636
doc['score'] = 90
3737
doc['description'] = ''
3838

@@ -49,7 +49,7 @@ def parse_notebook(path):
4949
doc['content'] = ''
5050
title = str(path)
5151
doc['title'] = title[title.find("tutorials/")+len("tutorials/"):]
52-
doc['icon'] = 'Jupyter_logo.png'
52+
doc['icon'] = '../../media/jupyter.png'
5353
doc['score'] = 90
5454
doc['description'] = ''
5555
for cell in data['cells']:
@@ -120,6 +120,7 @@ def load_imagej_tutorials(root):
120120

121121
return documents
122122

123+
# used for testing
123124
""" def main(args):
124125
docs = load_imagej_tutorials(args[0])
125126
for doc in docs:

0 commit comments

Comments
 (0)