Skip to content

Commit

Permalink
Fix search unlisted gists (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomiceli authored Sep 7, 2024
1 parent f881e1c commit 0950c9c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions internal/index/bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,18 @@ func SearchGists(queryStr string, queryMetadata SearchGistMetadata, gistsIds []u
indexerQuery = contentQuery
}

if len(gistsIds) > 0 {
repoQueries := make([]query.Query, 0, len(gistsIds))

truee := true
for _, id := range gistsIds {
f := float64(id)
qq := bleve.NewNumericRangeInclusiveQuery(&f, &f, &truee, &truee)
qq.SetField("GistID")
repoQueries = append(repoQueries, qq)
}

indexerQuery = bleve.NewConjunctionQuery(bleve.NewDisjunctionQuery(repoQueries...), indexerQuery)
repoQueries := make([]query.Query, 0, len(gistsIds))

truee := true
for _, id := range gistsIds {
f := float64(id)
qq := bleve.NewNumericRangeInclusiveQuery(&f, &f, &truee, &truee)
qq.SetField("GistID")
repoQueries = append(repoQueries, qq)
}

indexerQuery = bleve.NewConjunctionQuery(bleve.NewDisjunctionQuery(repoQueries...), indexerQuery)

addQuery := func(field, value string) {
if value != "" && value != "." {
q := bleve.NewMatchPhraseQuery(value)
Expand Down

0 comments on commit 0950c9c

Please sign in to comment.