Skip to content

Commit

Permalink
fix index.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
NeelamMahapatro committed Jan 19, 2024
1 parent a820f62 commit 70264f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2393,17 +2393,20 @@ std::pair<uint32_t, uint32_t> Index<T, TagT, LabelT>::search_with_filters(const
if (pos == K)
break;
}
if (pos <= K && context.GetAllowLessThanKResults())
if (pos < K && context.GetAllowLessThanKResults())
{
context.SetState(State::Success);
context.UpdateResultReturned(pos);
}
else if(pos < K)
{
context.SetState(State::Failure);
context.UpdateResultReturned(pos);
}
else
{
context.SetState(State::Failure);
context.SetState(State::Success);
context.UpdateResultReturned(K);
}

return retval;
Expand Down

0 comments on commit 70264f9

Please sign in to comment.