diff options
Diffstat (limited to 'cache/repo_cache_bug.go')
-rw-r--r-- | cache/repo_cache_bug.go | 13 |
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") } |