Skip to content

Commit

Permalink
Remove MakeSearchResponseMarshalled() from production code
Browse files Browse the repository at this point in the history
  • Loading branch information
pivovarit committed May 20, 2024
1 parent e19f6f4 commit 4672781
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 0 additions & 8 deletions quesma/queryparser/query_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,6 @@ func (cw *ClickhouseQueryTranslator) MakeSearchResponse(ResultSet []model.QueryR
}
}

func (cw *ClickhouseQueryTranslator) MakeSearchResponseMarshalled(ResultSet []model.QueryResultRow, query model.Query) ([]byte, error) {
response, err := cw.MakeSearchResponse(ResultSet, query)
if err != nil {
return nil, err
}
return response.Marshal()
}

func (cw *ClickhouseQueryTranslator) makeSearchResponseFacets(ResultSet []model.QueryResultRow, typ model.SearchQueryType) *model.SearchResp {
const maxFacets = 10 // facets show only top 10 values
bucketsNr := min(len(ResultSet), maxFacets)
Expand Down
4 changes: 3 additions & 1 deletion quesma/queryparser/query_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ func TestMakeResponseSearchQuery(t *testing.T) {
cw := ClickhouseQueryTranslator{Table: &clickhouse.Table{Name: "test"}, Ctx: context.Background()}
for i, tt := range args {
t.Run(tt.queryType.String(), func(t *testing.T) {
ourResponse, err := cw.MakeSearchResponseMarshalled(args[i].ourQueryResult, model.Query{QueryInfo: model.SearchQueryInfo{Typ: args[i].queryType}, Highlighter: NewEmptyHighlighter()})
ourResponseRaw, err := cw.MakeSearchResponse(args[i].ourQueryResult, model.Query{QueryInfo: model.SearchQueryInfo{Typ: args[i].queryType}, Highlighter: NewEmptyHighlighter()})
assert.NoError(t, err)
ourResponse, err := ourResponseRaw.Marshal()
assert.NoError(t, err)
actualMinusExpected, expectedMinusActual, err := util.JsonDifference(string(ourResponse), args[i].elasticResponseJson)
if err != nil {
Expand Down

0 comments on commit 4672781

Please sign in to comment.