mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42:40 +00:00
Fix search unlisted gists (#319)
This commit is contained in:
parent
f881e1c13c
commit
0950c9ce38
1 changed files with 9 additions and 11 deletions
|
@ -98,20 +98,18 @@ func SearchGists(queryStr string, queryMetadata SearchGistMetadata, gistsIds []u
|
||||||
indexerQuery = contentQuery
|
indexerQuery = contentQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(gistsIds) > 0 {
|
repoQueries := make([]query.Query, 0, len(gistsIds))
|
||||||
repoQueries := make([]query.Query, 0, len(gistsIds))
|
|
||||||
|
|
||||||
truee := true
|
truee := true
|
||||||
for _, id := range gistsIds {
|
for _, id := range gistsIds {
|
||||||
f := float64(id)
|
f := float64(id)
|
||||||
qq := bleve.NewNumericRangeInclusiveQuery(&f, &f, &truee, &truee)
|
qq := bleve.NewNumericRangeInclusiveQuery(&f, &f, &truee, &truee)
|
||||||
qq.SetField("GistID")
|
qq.SetField("GistID")
|
||||||
repoQueries = append(repoQueries, qq)
|
repoQueries = append(repoQueries, qq)
|
||||||
}
|
|
||||||
|
|
||||||
indexerQuery = bleve.NewConjunctionQuery(bleve.NewDisjunctionQuery(repoQueries...), indexerQuery)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
indexerQuery = bleve.NewConjunctionQuery(bleve.NewDisjunctionQuery(repoQueries...), indexerQuery)
|
||||||
|
|
||||||
addQuery := func(field, value string) {
|
addQuery := func(field, value string) {
|
||||||
if value != "" && value != "." {
|
if value != "" && value != "." {
|
||||||
q := bleve.NewMatchPhraseQuery(value)
|
q := bleve.NewMatchPhraseQuery(value)
|
||||||
|
|
Loading…
Reference in a new issue