Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding back an exported Analyze(..) API for scorch & upsidedown #1540

Merged
merged 3 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index/scorch/scorch.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ func (s *Scorch) StatsMap() map[string]interface{} {
return m
}

func (s *Scorch) Analyze(d index.Document) {
analyze(d)
}

func analyze(d index.Document) {
d.VisitFields(func(field index.Field) {
if field.Options().IsIndexed() {
Expand Down
4 changes: 4 additions & 0 deletions index/upsidedown/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ type AnalysisResult struct {
Rows []IndexRow
}

func (udc *UpsideDownCouch) Analyze(d index.Document) *AnalysisResult {
return udc.analyze(d)
}

func (udc *UpsideDownCouch) analyze(d index.Document) *AnalysisResult {
rv := &AnalysisResult{
DocID: d.ID(),
Expand Down
4 changes: 2 additions & 2 deletions test/tests/sort/searches.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@
}
},
{
"comment": "sort by age, descending, missing first",
"comment": "sort by age, descending, missing first, id, ascending",
"search": {
"from": 0,
"size": 10,
"query": {
"match_all":{}
},
"sort": [{"by":"field","field":"age","missing":"first","desc":true}]
"sort": [{"by":"field","field":"age","missing":"first","desc":true},{"by":"id","desc":false}]
},
"result": {
"total_hits": 6,
Expand Down