feat(search): make OKF document descriptions full-text searchable

Merged
SH
2h ago
+129-3

What

A search for a phrase from an OKF document's frontmatter description now finds that document, on Search V2 and Search V3.

The description was stored only in okfProperties.description, which had no @Searchable annotation, and documents have no other description field. This PR annotates it the way other assets' descriptions are annotated (for example datasetProperties.description):

  • Search V2: TEXT, queried by default, default boost, indexed as the document's description field (with description.delimited).
  • Search V3: joins the shared description label (keyword not indexed, text and stemmed subfields), queried by default.
  • hasDescription: set when a document has a description. The registry validator requires every field on the shared V3 description label to declare the same hasValuesFieldName, so this is needed, not optional.

No UI or ingestion code changes. The GitHub documents source docs now say the description is searchable.

Upgrade

The new fields are added to the existing mappings, so no reindex is needed. Documents written before the upgrade can't be found by their description until they're written again. To make them searchable right away, run RestoreIndices for document (or aspectNames=okfProperties). Documents with a description also get hasDescription, so on an empty (*) search they get the same ranking boost as other described assets.

The okfProperties schemaVersion is bumped to 2, and the search template golden (field-manifest.json) now lists description among the document's V3 query fields.

Tests

  • V3SearchFieldsTest: the document entity's V3 full-text description field now has the OKF description as its source.
  • V3SearchFieldModelTest: the document index group now supports full-text description. The negative case moves to dataHubIngestionSource, which has no description.
  • SearchQueryBuilderTest: the document's V2 default query fields include description and description.delimited.
  • New smoke test smoke-test/tests/e2e/knowledge/test_okf_search.py: writes an OKF document whose marker word appears only in its description, then finds it with searchAcrossEntities by the word and by a phrase.

How I tested it locally:

  • ./gradlew :metadata-io:test filtered to V3SearchFieldModelTest, V3SearchFieldsTest, MultiEntityMappingsBuilderTest, V2MappingsBuilderTest, SearchDocumentTransformerTest, V3SearchDocumentProjectorTest and SearchQueryBuilderTest: all pass.
  • Docker-free stack (scripts/dev/datahub-dev.sh start --local --job smoke-test, Search V3 by default): the new smoke test and test_okf_reimport.py pass.
  • On that stack, the live documentindex_v3 mapping has description (text/stemmed) and hasDescription.
  • Manual negative check on that stack: a marker that appears only in the description is found, and a marker that appears only in okfProperties.raw is not.

Checklist

  • PR title follows the Contributing Guideline
  • Tests added/updated

šŸ¤– Opened with cclaude on behalf of @shirshanka