Skip to content

Feature: Don't early-exit filtered search before wanted results are found #751

@Jeadie

Description

@Jeadie

Describe what you are looking for

When using filtered_search with a predicate, the search often returns fewer than wanted results even when plenty of passing nodes exist in the graph.

I think the issue is in search_to_find_in_base_:

if ((-candidate.distance) > radius)
    break;

radius comes from top.top().distance, but only predicate-passing nodes enter top. So with a selective predicate, radius collapses to the nearest passing node and the traversal exits almost immediately — before finding wanted results.

Without a predicate every node enters top, so radius tracks the true exploration frontier and this works fine. With a predicate they diverge.

This would keep traversing through non-passing nodes until enough passing results are found (or the graph is exhausted), while preserving the existing early-exit when no predicate is used.

Can you contribute to the implementation?

  • I can contribute

Is your feature request specific to a certain interface?

C++ implementation

Contact Details

jack@spice.ai

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions