Skip to content

Fix unqualified search for collector instances table (#25479)#25567

Merged
kroepke merged 5 commits intomasterfrom
fix_attribute_search
Apr 15, 2026
Merged

Fix unqualified search for collector instances table (#25479)#25567
kroepke merged 5 commits intomasterfrom
fix_attribute_search

Conversation

@kroepke
Copy link
Copy Markdown
Member

@kroepke kroepke commented Apr 7, 2026

Description

SearchQueryParser ignored bsonFilterCreator and dbField overrides when resolving the default search field from EntityAttributes. Unqualified searches (bare terms without a field: prefix) generated queries against the literal default field name instead of using the attribute's custom filter logic, producing empty results for fields backed by attribute arrays.

Resolve the default field from the dbFieldMapping after it is built so it inherits the bsonFilterCreator and correct dbField. Also update the collector instances resource to use hostname as the default search field instead of instance_uid.

/nocl internal improvement

Fixes #25479

How Has This Been Tested?

Added test cases.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

SearchQueryParser ignored bsonFilterCreator and dbField overrides when
resolving the default search field from EntityAttributes. Unqualified
searches (bare terms without a field: prefix) generated queries against
the literal default field name instead of using the attribute's custom
filter logic, producing empty results for fields backed by attribute
arrays.

Resolve the default field from the dbFieldMapping after it is built so
it inherits the bsonFilterCreator and correct dbField. Also update the
collector instances resource to use hostname as the default search
field instead of instance_uid.
@kroepke kroepke requested a review from a team April 7, 2026 15:09
@thll thll self-assigned this Apr 15, 2026
Copy link
Copy Markdown
Contributor

@thll thll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works!

A bit of JavaDoc would be nice but I'm approving anyways.

@@ -142,9 +142,15 @@ public SearchQueryParser(@Nonnull String defaultField,
public SearchQueryParser(@Nonnull String defaultField,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add JavaDoc explaining the behavior? The other constructor require the default field to be already mapped, this is different here.

@thll thll removed their assignment Apr 15, 2026
@kroepke kroepke merged commit 9b5040d into master Apr 15, 2026
23 checks passed
@kroepke kroepke deleted the fix_attribute_search branch April 15, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instances table does not have a default search field

3 participants