From ab42e5e1ab283f02c03da32e0cc494cb0956759f Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 9 Mar 2019 18:43:32 -0500 Subject: [PATCH] feat: postgres search engine --- client/components/common/nav-header.vue | 33 ++++++--- client/components/common/search-results.vue | 34 +++++++-- client/static/svg/icon-search-alt.svg | 2 + client/store/site.js | 1 + dev/search-engines/solr/solrconfig.xml | 2 + package.json | 1 + server/modules/search/db/engine.js | 22 ------ server/modules/search/postgres/engine.js | 82 ++++++++++++++++----- 8 files changed, 122 insertions(+), 55 deletions(-) create mode 100644 client/static/svg/icon-search-alt.svg create mode 100644 dev/search-engines/solr/solrconfig.xml diff --git a/client/components/common/nav-header.vue b/client/components/common/nav-header.vue index c2b04683..8f4aa819 100644 --- a/client/components/common/nav-header.vue +++ b/client/components/common/nav-header.vue @@ -2,18 +2,18 @@ v-toolbar.nav-header(color='black', dark, app, clipped-left, fixed, flat, :extended='searchIsShown && $vuetify.breakpoint.smAndDown') v-toolbar(color='deep-purple', flat, slot='extension', v-if='searchIsShown && $vuetify.breakpoint.smAndDown') v-text-field( - ref='searchFieldMobile', - v-model='search', - clearable, + ref='searchFieldMobile' + v-model='search' + clearable background-color='deep-purple' - color='white', - label='Search...', - single-line, + color='white' + label='Search...' + single-line solo flat - hide-details, - prepend-inner-icon='search', - :loading='searchIsLoading', + hide-details + prepend-inner-icon='search' + :loading='searchIsLoading' @keyup.enter='searchEnter' ) v-layout(row) @@ -73,7 +73,9 @@ prepend-inner-icon='search', :loading='searchIsLoading', @keyup.enter='searchEnter' - @keyup.esc='search = ``' + @keyup.esc='searchClose' + @focus='searchFocus' + @blur='searchBlur' ) v-progress-linear( indeterminate, @@ -191,6 +193,7 @@ export default { }, computed: { search: sync('site/search'), + searchIsFocused: sync('site/searchIsFocused'), searchIsLoading: sync('site/searchIsLoading'), searchRestrictLocale: sync('site/searchRestrictLocale'), searchRestrictPath: sync('site/searchRestrictPath'), @@ -231,6 +234,16 @@ export default { } }, methods: { + searchFocus() { + this.searchIsFocused = true + }, + searchBlur() { + this.searchIsFocused = false + }, + searchClose() { + this.search = '' + this.searchBlur() + }, searchToggle() { this.searchIsShown = !this.searchIsShown if (this.searchIsShown) { diff --git a/client/components/common/search-results.vue b/client/components/common/search-results.vue index 97ea42c4..c20eafdc 100644 --- a/client/components/common/search-results.vue +++ b/client/components/common/search-results.vue @@ -1,14 +1,17 @@