Merge pull request #9745 from keynslug/fix/EMQX-8702/changelog
chore: add changelog for the fuzzy search API fix
This commit is contained in:
commit
33d88c95de
|
@ -405,11 +405,11 @@ counting_total_fun(_QueryState = #{fuzzy_fun := FuzzyFun}) when FuzzyFun =/= und
|
||||||
%% ResultAcc :: #{count := integer(),
|
%% ResultAcc :: #{count := integer(),
|
||||||
%% cursor := integer(),
|
%% cursor := integer(),
|
||||||
%% rows := [{node(), Rows :: list()}],
|
%% rows := [{node(), Rows :: list()}],
|
||||||
%% partial := boolean(),
|
%% overflow := boolean(),
|
||||||
%% hasnext => boolean()
|
%% hasnext => boolean()
|
||||||
%% }
|
%% }
|
||||||
init_query_result() ->
|
init_query_result() ->
|
||||||
#{cursor => 0, count => 0, rows => [], partial => false}.
|
#{cursor => 0, count => 0, rows => [], overflow => false}.
|
||||||
|
|
||||||
accumulate_query_rows(
|
accumulate_query_rows(
|
||||||
Node,
|
Node,
|
||||||
|
@ -436,12 +436,13 @@ accumulate_query_rows(
|
||||||
cursor => NCursor,
|
cursor => NCursor,
|
||||||
count => Count + length(SubRows),
|
count => Count + length(SubRows),
|
||||||
rows => [{Node, SubRows} | RowsAcc],
|
rows => [{Node, SubRows} | RowsAcc],
|
||||||
partial => (Limit - Count) < Len
|
% there are more rows than can fit in the page
|
||||||
|
overflow => (Limit - Count) < Len
|
||||||
}}
|
}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
finalize_query(Result = #{partial := Partial}, QueryState = #{complete := Complete}) ->
|
finalize_query(Result = #{overflow := Overflow}, QueryState = #{complete := Complete}) ->
|
||||||
HasNext = Partial orelse not Complete,
|
HasNext = Overflow orelse not Complete,
|
||||||
maybe_accumulate_totals(Result#{hasnext => HasNext}, QueryState).
|
maybe_accumulate_totals(Result#{hasnext => HasNext}, QueryState).
|
||||||
|
|
||||||
maybe_accumulate_totals(Result, #{total := TotalAcc}) ->
|
maybe_accumulate_totals(Result, #{total := TotalAcc}) ->
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Client fuzzy search API results were missing information which could tell if more results are available in the next pages, this is now fixed by providing `hasnext` flag in the response.
|
|
@ -0,0 +1 @@
|
||||||
|
在此修复前,客户端模糊搜索 API 缺少一些可以用于判断是否可以继续翻页的信息,现在通过在响应中提供 `hasnext` 标志来解决这个问题。
|
Loading…
Reference in New Issue