This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git

commit 9f6cf4a6b09ba2abcb554a1cc2fe3c6a2d0999de
Author: hgaol <[email protected]>
AuthorDate: Tue Dec 26 16:02:08 2023 +0800

    fix: update elastic search plugin to be compatible with latest search 
interface
    
    (cherry picked from commit 1c4165ac1496907bd31ed91fcebcd2d2472debac)
---
 search-elasticsearch/es.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/search-elasticsearch/es.go b/search-elasticsearch/es.go
index 967d77a..3a0cb9a 100644
--- a/search-elasticsearch/es.go
+++ b/search-elasticsearch/es.go
@@ -247,8 +247,10 @@ func (s *SearchEngine) buildQuery(cond 
*plugin.SearchBasicCond) (
        log.Debugf("build query: %+v", cond)
 
        q := elastic.NewBoolQuery()
-       if len(cond.TagIDs) > 0 {
-               q.Must(elastic.NewTermsQuery("tags", 
convertToInterfaceSlice(cond.TagIDs)...))
+       for _, tagGroup := range cond.TagIDs {
+               if len(tagGroup) > 0 {
+                       q.Must(elastic.NewTermsQuery("tags", 
convertToInterfaceSlice(tagGroup)...))
+               }
        }
        if len(cond.UserID) > 0 {
                q.Must(elastic.NewTermQuery("user_id", cond.UserID))

Reply via email to