You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ku...@apache.org on 2024/01/04 03:51:08 UTC
(incubator-answer-plugins) branch main updated (1c4165a -> 0c16db5)
This is an automated email from the ASF dual-hosted git repository.
kumfo pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
from 1c4165a fix: update elastic search plugin to be compatible with latest search interface
new 091a566 fix: update meilisearch plugin to be compatible with latest search interface
new 0c16db5 fix: update algolia search plugin to be compatible with latest search interface (5 days ago)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
search-algolia/algolia.go | 30 ++++++++++++++++++++++++------
search-meilisearch/meilisearch.go | 11 ++++++++---
2 files changed, 32 insertions(+), 9 deletions(-)
(incubator-answer-plugins) 02/02: fix: update algolia search plugin to be compatible with latest search interface (5 days ago)
Posted by ku...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kumfo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
commit 0c16db54b98f2d156fdc476e12b0f51355453325
Author: hgaol <dh...@hotmail.com>
AuthorDate: Tue Jan 2 22:13:26 2024 +0800
fix: update algolia search plugin to be compatible with latest search interface (5 days ago)
---
search-algolia/algolia.go | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/search-algolia/algolia.go b/search-algolia/algolia.go
index 9ba1406..fb6054f 100644
--- a/search-algolia/algolia.go
+++ b/search-algolia/algolia.go
@@ -71,8 +71,14 @@ func (s *SearchAlgolia) SearchContents(ctx context.Context, cond *plugin.SearchB
votesFilter string
)
if len(cond.TagIDs) > 0 {
- for _, tagID := range cond.TagIDs {
- tagFilters = append(tagFilters, "tags:"+tagID)
+ for _, tagGroup := range cond.TagIDs {
+ var tagsIn []string
+ if len(tagGroup) > 0 {
+ for _, tagID := range tagGroup {
+ tagsIn = append(tagsIn, "tags:" + tagID)
+ }
+ }
+ tagFilters = append(tagFilters, "(" + strings.Join(tagsIn, " OR ") + ")")
}
if len(tagFilters) > 0 {
filters += " AND " + strings.Join(tagFilters, " AND ")
@@ -121,8 +127,14 @@ func (s *SearchAlgolia) SearchQuestions(ctx context.Context, cond *plugin.Search
answersFilter string
)
if len(cond.TagIDs) > 0 {
- for _, tagID := range cond.TagIDs {
- tagFilters = append(tagFilters, "tags:"+tagID)
+ for _, tagGroup := range cond.TagIDs {
+ var tagsIn []string
+ if len(tagGroup) > 0 {
+ for _, tagID := range tagGroup {
+ tagsIn = append(tagsIn, "tags:" + tagID)
+ }
+ }
+ tagFilters = append(tagFilters, "(" + strings.Join(tagsIn, " OR ") + ")")
}
if len(tagFilters) > 0 {
filters += " AND " + strings.Join(tagFilters, " AND ")
@@ -178,8 +190,14 @@ func (s *SearchAlgolia) SearchAnswers(ctx context.Context, cond *plugin.SearchBa
questionIDFilter string
)
if len(cond.TagIDs) > 0 {
- for _, tagID := range cond.TagIDs {
- tagFilters = append(tagFilters, "tags:"+tagID)
+ for _, tagGroup := range cond.TagIDs {
+ var tagsIn []string
+ if len(tagGroup) > 0 {
+ for _, tagID := range tagGroup {
+ tagsIn = append(tagsIn, "tags:" + tagID)
+ }
+ }
+ tagFilters = append(tagFilters, "(" + strings.Join(tagsIn, " OR ") + ")")
}
if len(tagFilters) > 0 {
filters += " AND " + strings.Join(tagFilters, " AND ")
(incubator-answer-plugins) 01/02: fix: update meilisearch plugin to be compatible with latest search interface
Posted by ku...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kumfo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
commit 091a5669638322ad077f4e209e576752b4089ba6
Author: hgaol <dh...@hotmail.com>
AuthorDate: Thu Dec 28 17:40:03 2023 +0800
fix: update meilisearch plugin to be compatible with latest search interface
---
search-meilisearch/meilisearch.go | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/search-meilisearch/meilisearch.go b/search-meilisearch/meilisearch.go
index 52aa3c1..352b81e 100644
--- a/search-meilisearch/meilisearch.go
+++ b/search-meilisearch/meilisearch.go
@@ -23,13 +23,14 @@ import (
"context"
"encoding/json"
"fmt"
+ "strings"
+ "sync"
+
"github.com/apache/incubator-answer-plugins/search-meilisearch/i18n"
"github.com/apache/incubator-answer/plugin"
"github.com/meilisearch/meilisearch-go"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
- "strings"
- "sync"
)
const (
@@ -321,7 +322,11 @@ func (s *Search) buildQuery(cond *plugin.SearchBasicCond) (string, *meilisearch.
func (s *Search) buildFilter(cond *plugin.SearchBasicCond) []string {
var filter []string
if cond.TagIDs != nil && len(cond.TagIDs) > 0 {
- filter = append(filter, fmt.Sprintf("tags IN [%s]", strings.Join(cond.TagIDs, ",")))
+ for _, tagGroup := range cond.TagIDs {
+ if len(tagGroup) > 0 {
+ filter = append(filter, fmt.Sprintf("tags IN [%s]", strings.Join(tagGroup, ",")))
+ }
+ }
}
if cond.UserID != "" {
filter = append(filter, fmt.Sprintf("userID = %s", cond.UserID))