aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-11-05 19:17:10 +0100
committerMike Goldin <mike.goldin@protonmail.ch>2020-11-17 08:09:51 -0500
commit9bea84e232ea4ae281a7b67c9e27f3a2b6215045 (patch)
tree821a44305ebe787b79f576341b20ee193a9f8408 /cache
parentef0727860ad652e0836b74d4a94e840f5102e243 (diff)
downloadgit-bug-9bea84e232ea4ae281a7b67c9e27f3a2b6215045.tar.gz
ls: fix query quotation
Diffstat (limited to 'cache')
-rw-r--r--cache/repo_cache_bug.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/cache/repo_cache_bug.go b/cache/repo_cache_bug.go
index 4afcbe70..19453734 100644
--- a/cache/repo_cache_bug.go
+++ b/cache/repo_cache_bug.go
@@ -307,10 +307,17 @@ func (c *RepoCache) QueryBugs(q *query.Query) []entity.Id {
if q.Search != nil {
foundBySearch = map[entity.Id]*BugExcerpt{}
- query := bleve.NewQueryStringQuery(strings.Join(q.Search, " "))
+ terms := make([]string, len(q.Search))
+ copy(terms, q.Search)
+ for i, search := range q.Search {
+ if strings.Contains(search, " ") {
+ terms[i] = fmt.Sprintf("\"%s\"", search)
+ }
+ }
- search := bleve.NewSearchRequest(query)
- searchResults, err := c.searchCache.Search(search)
+ bleveQuery := bleve.NewQueryStringQuery(strings.Join(terms, " "))
+ bleveSearch := bleve.NewSearchRequest(bleveQuery)
+ searchResults, err := c.searchCache.Search(bleveSearch)
if err != nil {
panic("bleve search failed")
}