Skip to content

Allow indexer bolts to use a metadata value as the document ID#2012

Merged
jnioche merged 6 commits into
mainfrom
feat/671-indexer-docid-from-metadata
Jul 23, 2026
Merged

Allow indexer bolts to use a metadata value as the document ID#2012
jnioche merged 6 commits into
mainfrom
feat/671-indexer-docid-from-metadata

Conversation

@sigee

@sigee sigee commented Jul 22, 2026

Copy link
Copy Markdown
Member

The change should cover the discussion in the #671 issue.

@sigee
sigee requested a review from jnioche July 23, 2026 09:16

@jnioche jnioche left a comment

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.

Looks good, forgot to mention that we should add the new indexer.md.docid to core/src/main/resources/crawler-default.yaml
with a default value of "".

@rzo1 rzo1 left a comment

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.

Changes look good to me, but we should update the docs alongside this PR too, so people get an updated doc version ;-)

@dpol1 dpol1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Implementation looks correct and backward compatible. One design question for the maintainers: with content-based dedup, N URLs share one document. When a single URL goes away, the DeletionBolt deletes the document even if the content is still live under the other URLs, until one gets re-fetched. Acceptable as a documented limitation, or should deletion be skipped when the ID comes from metadata?

Inline comments cover a metadata.persist prerequisite and backend coverage of the new setting.


| indexer.canonical.name | canonical | Metadata key for the canonical URL. Used to replace the URL with its canonical form before indexing.
| indexer.ignore.empty.fields | false | If true, skip fields with empty values when indexing.
| indexer.md.docid | - | Metadata key whose value, if present, is used as the document ID instead of the default SHA-256 digest of the URL. Useful e.g. for content-based deduplication when a `ParseFilter` stores a content hash in the metadata.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two precisions for this row: the value is digested, not used raw (SHA-256 here, SHA-512 via CloudSearchUtils.getID for CloudSearch); and the SOLR/SQL indexers never call getDocumentID(), so the setting is silently ignored there. Worth stating the supported backends.

* at. Falls back to the default (a SHA-256 digest of the URL) if not set or if the metadata
* does not contain a value for the configured key.
*/
public static final String DOC_ID_METADATA_PARAM_NAME = "indexer.md.docid";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Worth documenting: on the deletion path (gone pages) there's no parsing, so the DeletionBolt only sees this key if it's in metadata.persist and round-trips through the status index. Otherwise it falls back to sha256(url) and the document indexed under the metadata ID is silently orphaned.

@jnioche jnioche left a comment

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.

thanks @sigee

@jnioche jnioche added this to the 3.7.0 milestone Jul 23, 2026
@jnioche
jnioche merged commit 54c4a6d into main Jul 23, 2026
2 checks passed
@jnioche
jnioche deleted the feat/671-indexer-docid-from-metadata branch July 23, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants