@@ -4767,9 +4767,9 @@ inline constexpr std::string_view kSearchResultsKey = "search_results";
47674767inline constexpr std::string_view kAggregationResultsKey = " aggregation_results" ;
47684768
47694769inline List SearchTextIndex (mgp_graph *memgraph_graph, std::string_view index_name, std::string_view search_query,
4770- text_search_mode search_mode) {
4770+ text_search_mode search_mode, std:: size_t limit ) {
47714771 auto results_or_error = Map (mgp::MemHandlerCallback (graph_search_text_index, memgraph_graph, index_name.data (),
4772- search_query.data (), search_mode),
4772+ search_query.data (), search_mode, limit ),
47734773 StealType{});
47744774 if (results_or_error.KeyExists (kErrorMsgKey )) {
47754775 if (!results_or_error.At (kErrorMsgKey ).IsString ()) {
@@ -4790,9 +4790,9 @@ inline List SearchTextIndex(mgp_graph *memgraph_graph, std::string_view index_na
47904790}
47914791
47924792inline List SearchTextEdgeIndex (mgp_graph *memgraph_graph, std::string_view index_name, std::string_view search_query,
4793- text_search_mode search_mode) {
4793+ text_search_mode search_mode, std:: size_t limit ) {
47944794 auto results_or_error = Map (mgp::MemHandlerCallback (graph_search_text_edge_index, memgraph_graph, index_name.data (),
4795- search_query.data (), search_mode),
4795+ search_query.data (), search_mode, limit ),
47964796 StealType{});
47974797 if (results_or_error.KeyExists (kErrorMsgKey )) {
47984798 if (!results_or_error.At (kErrorMsgKey ).IsString ()) {
@@ -4837,6 +4837,29 @@ inline std::string AggregateOverTextIndex(mgp_graph *memgraph_graph, std::string
48374837 return std::string (results_or_error.At (kAggregationResultsKey ).ValueString ());
48384838}
48394839
4840+ inline std::string AggregateOverTextEdgeIndex (mgp_graph *memgraph_graph, std::string_view index_name,
4841+ std::string_view search_query, std::string_view aggregation_query) {
4842+ auto results_or_error = Map (mgp::MemHandlerCallback (graph_aggregate_over_text_edge_index, memgraph_graph,
4843+ index_name.data (), search_query.data (), aggregation_query.data ()),
4844+ StealType{});
4845+
4846+ if (results_or_error.KeyExists (kErrorMsgKey )) {
4847+ if (!results_or_error.At (kErrorMsgKey ).IsString ()) {
4848+ throw TextSearchException{" The error message is not a string!" };
4849+ }
4850+ throw TextSearchException (results_or_error.At (kErrorMsgKey ).ValueString ().data ());
4851+ }
4852+
4853+ if (!results_or_error.KeyExists (kAggregationResultsKey )) {
4854+ throw TextSearchException{" Incomplete text edge index aggregation results!" };
4855+ }
4856+
4857+ if (!results_or_error.At (kAggregationResultsKey ).IsString ()) {
4858+ throw TextSearchException{" Text edge index aggregation results have wrong type!" };
4859+ }
4860+ return std::string (results_or_error.At (kAggregationResultsKey ).ValueString ());
4861+ }
4862+
48404863inline List SearchVectorIndex (mgp_graph *memgraph_graph, std::string_view index_name, List &query_vector,
48414864 size_t result_size) {
48424865 auto results_or_error = Map (mgp::MemHandlerCallback (graph_search_vector_index, memgraph_graph, index_name.data (),
0 commit comments