diff --git a/src/server/search/doc_index.cc b/src/server/search/doc_index.cc index 99a6c909f262..e93095eaa7aa 100644 --- a/src/server/search/doc_index.cc +++ b/src/server/search/doc_index.cc @@ -333,7 +333,7 @@ std::pair PreprocessAggregateFields( sort_fields.emplace_back(fident, fname); } - return {fields, sort_fields}; + return {std::move(fields), std::move(sort_fields)}; } vector ShardDocIndex::SearchForAggregator( diff --git a/src/server/search/search_family.cc b/src/server/search/search_family.cc index 6c1b4f36a158..65c9665256aa 100644 --- a/src/server/search/search_family.cc +++ b/src/server/search/search_family.cc @@ -224,7 +224,7 @@ void ParseLoadFields(CmdArgParser* parser, std::optional* load StringOrView name = StringOrView::FromString(std::string{str}); if (parser->Check("AS")) { load_fields->value().emplace_back(name, true, - StringOrView::FromString(std::string{parser->Next()})); + StringOrView::FromString(parser->Next())); } else { load_fields->value().emplace_back(name, true); } @@ -268,11 +268,11 @@ optional ParseSearchParamsOrReply(CmdArgParser* parser, SinkReplyB size_t num_fields = parser->Next(); params.return_fields.emplace(); while (params.return_fields->size() < num_fields) { - StringOrView name = StringOrView::FromString(std::string{parser->Next()}); + StringOrView name = StringOrView::FromString(parser->Next()); if (parser->Check("AS")) { params.return_fields->emplace_back(std::move(name), true, - StringOrView::FromString(std::string{parser->Next()})); + StringOrView::FromString(parser->Next())); } else { params.return_fields->emplace_back(std::move(name), true); } @@ -283,7 +283,8 @@ optional ParseSearchParamsOrReply(CmdArgParser* parser, SinkReplyB } else if (parser->Check("PARAMS")) { // [PARAMS num(ignored) name(ignored) knn_vector] params.query_params = ParseQueryParams(parser); } else if (parser->Check("SORTBY")) { - params.sort_option = search::SortOption{string{parser->Next()}, bool(parser->Check("DESC"))}; + params.sort_option = + search::SortOption{parser->Next(), bool(parser->Check("DESC"))}; } else { // Unsupported parameters are ignored for now parser->Skip(1);