Skip to content

Commit

Permalink
feat: add fallback search
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Mar 11, 2024
1 parent d836bc7 commit c6fd87a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions internal/data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ func (d *Data) Search(query string) ([]string, error) {
if err != nil {
return nil, err
}
if len(searchResults.Hits) == 0 {
q2 := bleve.NewMatchPhraseQuery(query)
search = bleve.NewSearchRequest(q2)
searchResults, err = d.index.Search(search)
if err != nil {
return nil, err
}
}
var res []string
for _, hit := range searchResults.Hits {
res = append(res, hit.ID)
Expand Down
2 changes: 1 addition & 1 deletion internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (c AppDetailsCategory) Names() []string {

type GetAppListRequest struct {
// will return appinfo in this language
Language LanguageCode `url:"language,omitempty"`
Language LanguageCode `url:"l,omitempty"`
}

type GetAppListResponse struct {
Expand Down

0 comments on commit c6fd87a

Please sign in to comment.