branch bow-v2-go updated (be790d5 -> 2b06147)
This is an automated email from the git hooks/post-receive script. New change to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git from be790d5 modif du form de query pour permettre au navigateur firefox android de l'utiliser comme moteur de recherche new 697eb0d vu que sur firefox android il ne fait pas d'appel pour le suggest, pas besoin du token dans l'url new 180246a ajustement style du header new 2b06147 ajout de la recherche fulltext The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 2b0614716253838ff069b52890b1c6227f7fdde2 Author: Benjamin <poussin@codelutin.com> Date: Thu May 28 00:28:53 2020 +0200 ajout de la recherche fulltext commit 180246a144a5fbc360221c2cc1d1948ad5e4cf4d Author: Benjamin <poussin@codelutin.com> Date: Wed May 27 22:59:23 2020 +0200 ajustement style du header commit 697eb0d52d0725a9ec9cd026973ebca009fcc3d3 Author: Benjamin <poussin@codelutin.com> Date: Wed May 27 22:34:16 2020 +0200 vu que sur firefox android il ne fait pas d'appel pour le suggest, pas besoin du token dans l'url Summary of changes: pkg/repository/bookmarkRepository.go | 13 ++++++- web/src/components/SearchInput.vue | 69 ++++++++++++++++++++---------------- web/src/components/layout/Header.vue | 30 +++++----------- web/src/utils/FetchHelper.js | 9 ----- 4 files changed, 60 insertions(+), 61 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit 697eb0d52d0725a9ec9cd026973ebca009fcc3d3 Author: Benjamin <poussin@codelutin.com> Date: Wed May 27 22:34:16 2020 +0200 vu que sur firefox android il ne fait pas d'appel pour le suggest, pas besoin du token dans l'url --- web/src/components/SearchInput.vue | 2 +- web/src/utils/FetchHelper.js | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/web/src/components/SearchInput.vue b/web/src/components/SearchInput.vue index 4b874d5..9208eb5 100644 --- a/web/src/components/SearchInput.vue +++ b/web/src/components/SearchInput.vue @@ -10,7 +10,7 @@ <input type="text" v-model="mFulltext" @keyup.enter="searchFulltext" /> </label> </form> - <form :action="$fetch.createOpensearchUrl()"> + <form :action="$fetch.createUrl('/opensearch')"> <label> web: <input name="action" type="text" /> diff --git a/web/src/utils/FetchHelper.js b/web/src/utils/FetchHelper.js index a7fd61e..824aacd 100644 --- a/web/src/utils/FetchHelper.js +++ b/web/src/utils/FetchHelper.js @@ -1,17 +1,8 @@ -import Vue from 'vue' - let FetchHelper = { createUrl(url) { return window.BACKEND_URL + 'api/v1' + url }, - createOpensearchUrl() { - let token = Vue.$storage.getCookie('bow-token') - let result = this.createUrl(`/opensearch?bow-token=${token}`) - console.log('Opensearch url', result) - return result - }, - async fetch(url, method, headers, body) { headers = headers || {} if (!headers['Content-Type']) { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit 180246a144a5fbc360221c2cc1d1948ad5e4cf4d Author: Benjamin <poussin@codelutin.com> Date: Wed May 27 22:59:23 2020 +0200 ajustement style du header --- web/src/components/SearchInput.vue | 37 ++++++++++++++++++------------------ web/src/components/layout/Header.vue | 30 +++++++++-------------------- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/web/src/components/SearchInput.vue b/web/src/components/SearchInput.vue index 9208eb5..18972e3 100644 --- a/web/src/components/SearchInput.vue +++ b/web/src/components/SearchInput.vue @@ -1,20 +1,16 @@ <template> <div class="search"> - <form @submit.prevent="search"> - <label> - tags: - <TagsInput id="tags" v-model="tags" :availableTags="queryTags" :noCreation="true"></TagsInput> - </label> - <label> - fulltext: - <input type="text" v-model="mFulltext" @keyup.enter="searchFulltext" /> - </label> - </form> + <div> + <label for="tags">tags</label> + <TagsInput id="tags" v-model="tags" :availableTags="queryTags" :noCreation="true"></TagsInput> + </div> + <div> + <label for="fulltext">fulltext</label> + <input id="fulltext" type="text" v-model="mFulltext" @keyup.enter="searchFulltext" /> + </div> <form :action="$fetch.createUrl('/opensearch')"> - <label> - web: - <input name="action" type="text" /> - </label> + <label for="web">web</label> + <input id="web" name="action" type="text" /> </form> </div> </template> @@ -71,12 +67,15 @@ export default SearchInput flex-direction: row; padding-top: 0; padding-bottom: 0; + } -form { - display: flex; - flex-direction: row; + +.search > * { + flex-grow: 2; } -input { - width: 100px; + +.search > * { + display: flex; + flex-direction: column; } </style> diff --git a/web/src/components/layout/Header.vue b/web/src/components/layout/Header.vue index 851d84b..9c226c1 100644 --- a/web/src/components/layout/Header.vue +++ b/web/src/components/layout/Header.vue @@ -1,26 +1,18 @@ <template> <header> - <router-link to="/" class="header-logo"> - <img alt="Bow logo" src="../../assets/img/logos/bow-text.svg" /> - </router-link> - - <SearchInput></SearchInput> + <SearchInput class="search-input"></SearchInput> <div id="header-user-infos"> <span v-if="authenticated"> <router-link to="/preferences"> - {{ this.user.login }} (bow user since {{ new Date(this.user.creationdate).getFullYear() }}) + {{ this.user.login }} </router-link> + <span id="since">(bow user since {{ new Date(this.user.creationdate).getFullYear() }})</span> <button @click="logout">Logout</button> </span> <span v-else> <router-link to="/login">Login</router-link> </span> - - <!-- <a href="/preferences" cssClass="header-link">User Login</a> - <a href="/logout" class="header-link"> - <i class="icon-logout icon"></i> - </a> --> </div> </header> </template> @@ -55,22 +47,18 @@ header { border-bottom: 1px solid #eee; - & > a, - & > div { - flex: 1; - height: 100%; - - padding: var(--margin--medium); + .search-input { + flex-grow: 2; } } -.header-logo { - text-align: left; +#since { + font-size: 75%; } -#header-user-infos { +#header-user-infos * { display: flex; - flex-direction: row; + flex-direction: column; align-items: center; justify-content: right; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit 2b0614716253838ff069b52890b1c6227f7fdde2 Author: Benjamin <poussin@codelutin.com> Date: Thu May 28 00:28:53 2020 +0200 ajout de la recherche fulltext --- pkg/repository/bookmarkRepository.go | 13 ++++++++++++- web/src/components/SearchInput.vue | 36 +++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/pkg/repository/bookmarkRepository.go b/pkg/repository/bookmarkRepository.go index 6a5244d..bf44774 100644 --- a/pkg/repository/bookmarkRepository.go +++ b/pkg/repository/bookmarkRepository.go @@ -46,7 +46,18 @@ func BookmarkJSON(currentUser model.BowUser, id string, uri string, tags []strin } else if uri != "" { mainQuery = `select * from bookmark where uri=$3` } else { - mainQuery = `select * from bookmark where tags @> string_to_array($1, ',')` + // si fulltext and vide, aucun resultat n'est retourne, ce n'est pas ce qu'on veut + // dans ce cas, on souhaite que la recherche ne porte que sur les tags + preventEmptyFulltext := "" + if (fulltext == "") { + preventEmptyFulltext = "true || " + } + // vu qu'on veut utiliser l'index fulltext créer, il faut les meme champs dans la requete (to_tsvector) + mainQuery = fmt.Sprintf(`select * from bookmark where + tags @> string_to_array($1, ',') + AND + (%s to_tsvector(lang, text(tags) || ' ' || description || ' ' || uri || ' ' || text(privateAlias) || ' ' || text(publicAlias)) @@ websearch_to_tsquery($2)) + `, preventEmptyFulltext) } tagsJoined := strings.Join(tags, ",") diff --git a/web/src/components/SearchInput.vue b/web/src/components/SearchInput.vue index 18972e3..9d63979 100644 --- a/web/src/components/SearchInput.vue +++ b/web/src/components/SearchInput.vue @@ -6,7 +6,7 @@ </div> <div> <label for="fulltext">fulltext</label> - <input id="fulltext" type="text" v-model="mFulltext" @keyup.enter="searchFulltext" /> + <input id="fulltext" type="text" v-model="fulltext" @keyup.enter="searchFulltext(mFulltext)" /> </div> <form :action="$fetch.createUrl('/opensearch')"> <label for="web">web</label> @@ -16,7 +16,7 @@ </template> <script> -import { Component, Vue, Watch } from 'vue-property-decorator' +import { Component, Vue } from 'vue-property-decorator' import TagsInput from '@/components/common/TagsInput' @Component({ @@ -24,12 +24,18 @@ import TagsInput from '@/components/common/TagsInput' components: { TagsInput } }) class SearchInput extends Vue { - mTags = '' + // mTags = '' mFulltext = '' + timeoutFulltextSearch = 0 + + cancelTimeoutFulltextSearch() { + this.timeoutFulltextSearch && clearTimeout(this.timeoutFulltextSearch) + this.timeoutFulltextSearch = 0 + } - searchFulltext() { - console.log('search', this.mFulltext) - this.changeFulltextAndGo(this.mFulltext) + searchFulltext(value) { + this.cancelTimeoutFulltextSearch() + this.changeFulltextAndGo(value) } get tags() { @@ -49,11 +55,16 @@ class SearchInput extends Vue { return this.queryInfo.fulltext } - // TODO supprimer ce watch faire comme pour les tags mais avec un timer avant le declenchement de la requete de recherche - @Watch('fulltext', { immediate: true, deep: true }) - onFulltextChange(fulltext) { - console.log('onFulltextChange SearchInput', fulltext) - this.mFulltext = this.fulltext + set fulltext(value) { + this.mFulltext = value + this.cancelTimeoutFulltextSearch() + this.timeoutFulltextSearch = setTimeout( + function(ft) { + this.searchFulltext(ft) + }.bind(this), + 1000, + value + ) } } @@ -67,11 +78,10 @@ export default SearchInput flex-direction: row; padding-top: 0; padding-bottom: 0; - } .search > * { - flex-grow: 2; + flex-grow: 2; } .search > * { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm