Skip to content

Commit 59b0526

Browse files
authored
Merge pull request #1825 from yrodiere/search-quarkus-io
Search through https://search.quarkus.io
2 parents 5bf6be0 + b39a5a7 commit 59b0526

15 files changed

+658
-319
lines changed

Diff for: _config.yml

+25
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,31 @@ url: "https://quarkus.io" # the base hostname & protocol for your site, e.g. htt
2222
twitter_username: quarkusio
2323
github_username: quarkusio
2424
github_fork_url: "https://github.com/quarkusio/quarkus"
25+
# The language code for this website, used in particular for search.quarkus.io.
26+
# See https://github.com/quarkusio/search.quarkus.io/blob/main/src/main/java/io/quarkus/search/app/entity/Language.java
27+
language: en
28+
search:
29+
# The URL of the remote search service
30+
url: "https://search.quarkus.io/"
31+
# The amount of time before we give up on a pending remote search and fall back to Javascript search.
32+
# The search service itself is reasonably fast on a decent machine (with curl: ~100ms median, ~150ms 90th percentile).
33+
# but it's slower on prod machines (with curl: ~200ms median, ~400ms 90th percentile),
34+
# and prod network overhead makes it even worse (with curl from France: ~750ms median, ~1000ms 90th percentile),
35+
# so we need a high timeout with some margin for varying network latency depending on browser location.
36+
# Such a high timeout is acceptable since Javascript search is almost instantaneous,
37+
# so when we hit the timeout the user won't experience much more delay.
38+
# See also https://docs.google.com/spreadsheets/d/1w0tSfL-MKFArSrB-L8IX1pxmrhWmQyNgNwQRloG3cLk/edit#gid=456110917
39+
initial-timeout: 1500
40+
# When fetching more pages, a timeout would be very bad for UX
41+
# since we would reset the whole page using Javascript --
42+
# while the user is reading through it!
43+
# This we set a higher timeout value, to make timeouts less likely.
44+
more-timeout: 2500
45+
# The minimum number of characters before we run a full search.
46+
# Below this:
47+
# - if another filter is selected (e.g. categories), we run Javascript search
48+
# - otherwise, we don't run search and just display all guides
49+
min-chars: 2
2550

2651
# Build settings
2752
error_mode: strict

Diff for: _config_dev.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Configuration for development
2+
3+
# We don't want to use the production instance of search.quarkus.io for development.
4+
search:
5+
url: "http://localhost:8080/"

Diff for: _includes/index-docs.html

+146-113
Original file line numberDiff line numberDiff line change
@@ -4,128 +4,161 @@
44
{% assign categories = index.quarkus.categories %}
55
{% assign by_type = index.quarkus | map: "types" | first %}
66

7-
8-
<section class="full-width-version-bg flexfilterbar">
9-
<div class="flexcontainer">
10-
<div class="flexlabel">
11-
<label>By Version</label>
12-
</div>
13-
<div class="pulldown version">
14-
<select id="guidesindex-version-dropdown">
15-
{% for version in site.data.versions.documentation %}
16-
<option value="{{ version }}" {% if docversion == version %}selected{% endif %}>{% if version == 'latest' %}{{ site.data.versions.quarkus.version | replace_regex: "\.[0-9+]\.Final", "" }} - {% endif %}{{ version | capitalize }}{% if version == 'main' %} - SNAPSHOT{% endif %}</option>
17-
{% endfor %}
18-
</select>
19-
</div>
20-
<div class="flexlabel">
21-
<label>By Category</label>
22-
</div>
23-
<div class="pulldown category">
24-
<select id="guidesindex-category-dropdown">
25-
<option value="">All categories</option>
26-
{% for item in categories %}
27-
<option value="{{ item.cat-id }}">{{ item.category }}</option>
28-
{% endfor %}
29-
</select>
30-
</div>
31-
<div class="search">
32-
<input type="text" id="search-text" placeholder="Filter by keyword" />
7+
<div id="guides-app"
8+
data-search-api-server="{{ site.search.url }}"
9+
data-quarkus-version="{{ docversion }}"
10+
data-language="{{ site.language }}"
11+
data-initial-timeout="{{ site.search.initial-timeout }}"
12+
data-more-timeout="{{ site.search.more-timeout }}"
13+
data-min-chars="{{ site.search.min-chars }}">
14+
<section class="full-width-version-bg flexfilterbar">
15+
<div class="flexcontainer">
16+
<div class="flexlabel">
17+
<label>By Version</label>
18+
</div>
19+
<div class="pulldown version">
20+
<select id="guidesindex-version-dropdown">
21+
{% for version in site.data.versions.documentation %}
22+
<option value="{{ version }}" {% if docversion == version %}selected{% endif %}>{% if version == 'latest' %}{{ site.data.versions.quarkus.version | replace_regex: "\.[0-9+]\.Final", "" }} - {% endif %}{{ version | capitalize }}{% if version == 'main' %} - SNAPSHOT{% endif %}</option>
23+
{% endfor %}
24+
</select>
25+
</div>
26+
<div class="flexlabel">
27+
<label>By Category</label>
28+
</div>
29+
<div class="pulldown category">
30+
<select v-model="category">
31+
<option value="">All categories</option>
32+
{% for item in categories %}
33+
<option value="{{ item.cat-id }}">{{ item.category }}</option>
34+
{% endfor %}
35+
</select>
36+
</div>
37+
<div class="search">
38+
<input v-model="text" type="text" placeholder="Filter by keyword" />
39+
</div>
3340
</div>
34-
</div>
35-
</section>
36-
41+
</section>
3742

38-
39-
<div>
40-
<h1 class="title">{{ page.title }}</h1>
41-
</div>
42-
<div class="grid-wrapper guides" id="docs">
43-
{% include index-docs-merge.html type="tutorial" %}
44-
{% if values %}
45-
<div class="grid__item width-12-12 docslist">
46-
<div class="doclist-header">
47-
<h3 id="tutorial">Tutorials</h3>
48-
<p>Short and focused exercises to get you going quickly.</p>
49-
</div>
50-
<div class="grid-wrapper">
51-
{% for guide in values %}
52-
{% include index-doc-item.html class="tutorialbkg" docversion=docversion
53-
title=guide.title url=guide.url summary=guide.summary
54-
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
55-
{% endfor %}
56-
</div>
43+
<div>
44+
<h1 class="title">{{ page.title }}</h1>
5745
</div>
58-
{% endif %}
59-
{% include index-docs-merge.html type="howto" %}
60-
{% if values %}
61-
<div class="grid__item width-12-12 docslist">
62-
<div class="doclist-header">
63-
<h3 id="guide">How-to Guides</h3>
64-
<p>Step-by-step guides to covering key tasks, real world operations and common problems.</p>
65-
</div>
66-
<div class="grid-wrapper">
67-
{% for guide in values %}
68-
{% include index-doc-item.html class="guidebkg" docversion=docversion
69-
title=guide.title url=guide.url summary=guide.summary
70-
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
71-
{% endfor %}
46+
<div v-if="hasInput" class="grid-wrapper guides results vuejs"
47+
:class="{ empty: !loading && !hasHits, 'vuejs-enabled': true, loading: loading }">
48+
<div class="grid__item width-12-12 docslist">
49+
<Transition name="fade-in">
50+
<div v-if="!loading && !hasHits" class="empty-placeholder">
51+
Sorry, no guides matched your search. Please try again.
52+
</div>
53+
</Transition>
54+
<div class="grid-wrapper">
55+
{% raw %}
56+
<div v-for="hit in searchHits" :class="`${hit.type}bkg grid__item docs-card`">
57+
<h4><a :href="hit.url" :target="hit.url.startsWith('http') ? '_blank' : ''" v-html="hit.title"></a></h4>
58+
<div class="description" v-html="hit.summary"></div>
59+
<div class="content-highlights">
60+
<p v-for="contentLine in hit.content" v-html="contentLine"></p>
61+
</div>
62+
</div>
63+
{% endraw %}
64+
<Transition name="fade-in">
65+
<div v-if="loading" class="loading-placeholder">
66+
Loading...
67+
</div>
68+
</Transition>
69+
</div>
7270
</div>
7371
</div>
74-
{% endif %}
75-
{% include index-docs-merge.html type="concepts" %}
76-
{% if values %}
77-
<div class="grid__item width-12-12 docslist">
78-
<div class="doclist-header">
79-
<h3 id="concept">Concepts</h3>
80-
<p>Explanations of some of the larger concepts and technologies involved with Quarkus.</p>
81-
</div>
82-
<div class="grid-wrapper">
83-
{% for guide in values %}
84-
{% include index-doc-item.html class="conceptbkg" docversion=docversion
85-
title=guide.title url=guide.url summary=guide.summary
86-
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
87-
{% endfor %}
72+
<!-- Static content displayed when there is no input in the search form or Javascript is disabled,
73+
but also used as a source of data for cards displayed by the vue.js app. -->
74+
<div v-else class="grid-wrapper guides" id="all-docs">
75+
{% include index-docs-merge.html type="tutorial" %}
76+
{% if values %}
77+
<div class="grid__item width-12-12 docslist">
78+
<div class="doclist-header">
79+
<h3 id="tutorial">Tutorials</h3>
80+
<p>Short and focused exercises to get you going quickly.</p>
81+
</div>
82+
<div class="grid-wrapper">
83+
{% for guide in values %}
84+
{% include index-doc-item.html class="tutorialbkg" docversion=docversion
85+
title=guide.title url=guide.url summary=guide.summary
86+
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
87+
{% endfor %}
88+
</div>
8889
</div>
89-
</div>
90-
{% endif %}
91-
{% include index-docs-merge.html type="reference" %}
92-
{% if values %}
93-
<div class="grid__item width-12-12 docslist">
94-
<div class="doclist-header">
95-
<h3 id="reference">References</h3>
96-
<p>Technical Resource that covers tools, components, and commands. The encyclopedia for Quarkus.</p>
90+
{% endif %}
91+
{% include index-docs-merge.html type="howto" %}
92+
{% if values %}
93+
<div class="grid__item width-12-12 docslist">
94+
<div class="doclist-header">
95+
<h3 id="guide">How-to Guides</h3>
96+
<p>Step-by-step guides to covering key tasks, real world operations and common problems.</p>
97+
</div>
98+
<div class="grid-wrapper">
99+
{% for guide in values %}
100+
{% include index-doc-item.html class="howtobkg" docversion=docversion
101+
title=guide.title url=guide.url summary=guide.summary
102+
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
103+
{% endfor %}
104+
</div>
97105
</div>
98-
<div class="grid-wrapper">
99-
<div class="grid__item docs-card pdfbkg">
100-
<h4><a href="https://lordofthejars.github.io/quarkus-cheat-sheet/" target="_blank">Quarkus Cheat Sheet</a></h4>
101-
<div class="description">Download full cheatsheet as PDF. <a href="https://developers.redhat.com/search?t=quarkus&f=type%7Echeat_sheet" target="_blank">
102-
Get more cheatsheets on the Red Hat Developers website. <i class="fas fa-external-link-alt"></i></a></div>
103-
<div class="keywords"></div>
104-
<div class="categories"></div>
105-
</div>
106-
{% for guide in values %}
107-
{% include index-doc-item.html class="referencebkg" docversion=docversion
108-
title=guide.title url=guide.url summary=guide.summary
109-
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
110-
{% endfor %}
106+
{% endif %}
107+
{% include index-docs-merge.html type="concepts" %}
108+
{% if values %}
109+
<div class="grid__item width-12-12 docslist">
110+
<div class="doclist-header">
111+
<h3 id="concept">Concepts</h3>
112+
<p>Explanations of some of the larger concepts and technologies involved with Quarkus.</p>
113+
</div>
114+
<div class="grid-wrapper">
115+
{% for guide in values %}
116+
{% include index-doc-item.html class="conceptsbkg" docversion=docversion
117+
title=guide.title url=guide.url summary=guide.summary
118+
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
119+
{% endfor %}
120+
</div>
111121
</div>
112-
</div>
113-
{% endif %}
114-
{% include index-docs-merge.html type="guide" %}
115-
{% if values %}
116-
<div class="grid__item width-12-12 docslist">
117-
<div class="doclist-header">
118-
<h3 id="reference">General Guides</h3>
119-
<p>Other Quarkus Guides</p>
122+
{% endif %}
123+
{% include index-docs-merge.html type="reference" %}
124+
{% if values %}
125+
<div class="grid__item width-12-12 docslist">
126+
<div class="doclist-header">
127+
<h3 id="reference">References</h3>
128+
<p>Technical Resource that covers tools, components, and commands. The encyclopedia for Quarkus.</p>
129+
</div>
130+
<div class="grid-wrapper">
131+
<div class="grid__item docs-card pdfbkg">
132+
<h4><a href="https://lordofthejars.github.io/quarkus-cheat-sheet/" target="_blank">Quarkus Cheat Sheet</a></h4>
133+
<div class="description">Download full cheatsheet as PDF. <a href="https://developers.redhat.com/search?t=quarkus&f=type%7Echeat_sheet" target="_blank">
134+
Get more cheatsheets on the Red Hat Developers website. <i class="fas fa-external-link-alt"></i></a></div>
135+
<div class="keywords"></div>
136+
<div class="categories"></div>
137+
</div>
138+
{% for guide in values %}
139+
{% include index-doc-item.html class="referencebkg" docversion=docversion
140+
title=guide.title url=guide.url summary=guide.summary
141+
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
142+
{% endfor %}
143+
</div>
120144
</div>
121-
<div class="grid-wrapper">
122-
{% for guide in values %}
123-
{% include index-doc-item.html class="referencebkg" docversion=docversion
124-
title=guide.title url=guide.url summary=guide.summary
125-
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
126-
{% endfor %}
145+
{% endif %}
146+
{% include index-docs-merge.html type="guide" %}
147+
{% if values %}
148+
<div class="grid__item width-12-12 docslist">
149+
<div class="doclist-header">
150+
<h3>General Guides</h3>
151+
<p>Other Quarkus Guides</p>
152+
</div>
153+
<div class="grid-wrapper">
154+
{% for guide in values %}
155+
{% include index-doc-item.html class="guidebkg" docversion=docversion
156+
title=guide.title url=guide.url summary=guide.summary
157+
keywords=guide.keywords categories=guide.categories origin=guide.origin %}
158+
{% endfor %}
159+
</div>
127160
</div>
161+
{% endif %}
128162
</div>
129-
{% endif %}
130-
<div class="grid__item width-12-12 empty-list">Sorry, no guides matched your search. Please try again.</div>
131163
</div>
164+
<script src="/assets/javascript/guides-app.js" type="module"></script>

0 commit comments

Comments
 (0)