branch bow-v2-go updated (2b06147 -> 578fd07)
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 2b06147 ajout de la recherche fulltext new 578fd07 ajout des highlighted sur la description et les tags pour expliquer la presence du bookmark dans les resultats The 1 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 578fd07bef814a2a9a1baf6c451ad801b7c56d03 Author: Benjamin <poussin@codelutin.com> Date: Thu May 28 01:24:27 2020 +0200 ajout des highlighted sur la description et les tags pour expliquer la presence du bookmark dans les resultats Summary of changes: pkg/repository/bookmarkRepository.go | 18 ++++++++++++++---- web/src/components/Bookmark.vue | 8 ++++++-- web/src/components/bookmark/Description.vue | 2 +- web/src/components/bookmark/Tags.vue | 5 +++-- web/src/components/common/TagsInput.vue | 1 - web/src/main.js | 10 ++++++---- 6 files changed, 30 insertions(+), 14 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 578fd07bef814a2a9a1baf6c451ad801b7c56d03 Author: Benjamin <poussin@codelutin.com> Date: Thu May 28 01:24:27 2020 +0200 ajout des highlighted sur la description et les tags pour expliquer la presence du bookmark dans les resultats --- pkg/repository/bookmarkRepository.go | 18 ++++++++++++++---- web/src/components/Bookmark.vue | 8 ++++++-- web/src/components/bookmark/Description.vue | 2 +- web/src/components/bookmark/Tags.vue | 5 +++-- web/src/components/common/TagsInput.vue | 1 - web/src/main.js | 10 ++++++---- 6 files changed, 30 insertions(+), 14 deletions(-) diff --git a/pkg/repository/bookmarkRepository.go b/pkg/repository/bookmarkRepository.go index bf44774..d212e91 100644 --- a/pkg/repository/bookmarkRepository.go +++ b/pkg/repository/bookmarkRepository.go @@ -48,16 +48,26 @@ func BookmarkJSON(currentUser model.BowUser, id string, uri string, tags []strin } else { // 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 := "" + var queryEmptyFulltext string + // highlighted description => hldescription + var hl string if (fulltext == "") { - preventEmptyFulltext = "true || " + queryEmptyFulltext = "true OR " + hl = "" + } else { + queryEmptyFulltext = "" + hl = `, + ts_headline(description, websearch_to_tsquery($2)) AS hldescription, + ts_headline(text(tags), websearch_to_tsquery($2))::text[] AS hltags` } // 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 + mainQuery = fmt.Sprintf(`select + *%s + 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) + `, hl, queryEmptyFulltext) } tagsJoined := strings.Join(tags, ",") diff --git a/web/src/components/Bookmark.vue b/web/src/components/Bookmark.vue index cfc244f..5b1d193 100644 --- a/web/src/components/Bookmark.vue +++ b/web/src/components/Bookmark.vue @@ -18,11 +18,11 @@ <button @click.prevent="deleteBookmark">Delete</button> </div> <!-- <span>{{ bookmark.authenticationinfo }}</span> faire afficher une popup de modification de l'objet auth--> - <Description :description="bookmark.description"></Description> + <Description :description="bookmark.hldescription || bookmark.description"></Description> <AuthenticationInfo v-if="bookmark.authenticationinfo" :authenticationinfo="bookmark.authenticationinfo"></AuthenticationInfo> <div class="info-footer"> <BookmarkDate :creationDate="date" :updateDate="bookmark.updatedate"></BookmarkDate> - <Tags :tags="bookmark.tags"></Tags> + <Tags :tags="bookmark.tags" :hltags="bookmark.hltags || bookmark.tags"></Tags> <!-- <span>{{ bookmark.lang }}</span> --> <!-- <span>{{ bookmark.owner }}</span> si mon id n'est pas le meme alors c'est le bookmark d'un autre partage par un group --> <Aliases @@ -104,6 +104,10 @@ export default Bookmark </script> <style lang="less"> +b { + color: red; +} + .bookmark { display: flex; flex-direction: row; diff --git a/web/src/components/bookmark/Description.vue b/web/src/components/bookmark/Description.vue index a8b1d8e..ab4a5b4 100644 --- a/web/src/components/bookmark/Description.vue +++ b/web/src/components/bookmark/Description.vue @@ -1,6 +1,6 @@ <template> <div class="description"> - <textarea v-model="description" readonly></textarea> + <div v-dompurify-html="description"></div> </div> </template> diff --git a/web/src/components/bookmark/Tags.vue b/web/src/components/bookmark/Tags.vue index ff0b67f..c975cb0 100644 --- a/web/src/components/bookmark/Tags.vue +++ b/web/src/components/bookmark/Tags.vue @@ -1,6 +1,6 @@ <template> <div class="tags"> - <span @click.prevent="addTag(tag)" class="tag" v-for="tag in tags || []" :key="tag">{{ tag }}</span> + <span @click.prevent="addTag(tag)" class="tag" v-for="(tag, i) in tags || []" :key="tag" v-dompurify-html="hltags[i] || tag"></span> </div> </template> @@ -9,11 +9,12 @@ import { Component, Prop, Vue } from 'vue-property-decorator' @Component({ name: 'Tags', - props: ['tags'], + props: ['tags', 'hltags'], components: {} }) class Tags extends Vue { @Prop tags + @Prop hltags addTag(tag) { this.addTagsAndGo([tag]) diff --git a/web/src/components/common/TagsInput.vue b/web/src/components/common/TagsInput.vue index fb072f0..14208ca 100644 --- a/web/src/components/common/TagsInput.vue +++ b/web/src/components/common/TagsInput.vue @@ -69,7 +69,6 @@ class TagsInput extends Vue { get filteredTags() { let lowerCased = this.currentTag.toLowerCase() - console.log('AAAAAAA', this.allTags) return this.allTags.filter((a) => { return a.text.toLowerCase().indexOf(lowerCased) !== -1 }) diff --git a/web/src/main.js b/web/src/main.js index 3fc728c..8b2e15b 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -148,16 +148,18 @@ Vue.mixin({ } }, queryInfo: function() { - return this.$store.state.query.info + return this.$store.state.query.info || {} }, queryTags: function() { - return this.$store.state.query.tags[0] + let tags = this.$store.state.query.tags || [[], []] + return tags[0] }, queryTagsCount: function() { - return this.$store.state.query.tags[1] + let tags = this.$store.state.query.tags || [[], []] + return tags[1] }, queryResult: function() { - return this.$store.state.query.result + return this.$store.state.query.result || [] } } }) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm