Skip to content

Expose harvested documents via each_document - #211

Open
thatbudakguy wants to merge 1 commit into
mainfrom
207-each-document
Open

thatbudakguy wants to merge 1 commit into
mainfrom
207-each-document

Conversation

@thatbudakguy

@thatbudakguy thatbudakguy commented Sep 17, 2026

Copy link
Copy Markdown
Member

Closes #207

Adds GeoBlacklightHarvester#each_document, mirroring the docs_to_index seam in GeoCombine::Harvester, so the documents harvested from a site can be used for something other than indexing them into Solr:

harvester = GeoCombine::GeoBlacklightHarvester.new(:earthworks)
harvester.each_document { |document| write_to_disk(document) }   # new
harvester.index                                                  # unchanged

#index is now a thin wrapper over a private #each_page enumerator, so it still posts to Solr one page at a time. Documents yielded have already been through the configured document transformer.

Also fixes a latent bug this refactor ran into: #index transformed each page with map! and then discarded the compacted copy, so documents a transformer omitted (by returning nil, which the README documents as supported) were posted to Solr as nulls rather than dropped.

@thatbudakguy
thatbudakguy changed the base branch from main to pin-json-below-3 September 17, 2026 23:43
@thatbudakguy
thatbudakguy added this pull request to stack #218 September 17, 2026 23:43
An error occurred while trying to automatically change base from pin-json-below-3 to main September 18, 2026 19:45
An error occurred while trying to automatically change base from pin-json-below-3 to main September 18, 2026 20:15
Refactors #index onto a private #each_page enumerator, so the documents
harvested from a site can be used for something other than indexing them
into Solr (e.g. writing them to disk for your own OpenGeoMetadata
repository). Mirrors the docs_to_index seam in GeoCombine::Harvester.

Also fixes documents the document transformer omits being sent to Solr as
nulls: #index mutated the page with map! and discarded the compacted copy.

Closes #207

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@thatbudakguy
thatbudakguy removed this pull request from stack #218 September 18, 2026 20:18
@thatbudakguy
thatbudakguy changed the base branch from pin-json-below-3 to main September 18, 2026 20:18
@thatbudakguy
thatbudakguy added this pull request to stack #219 September 18, 2026 20:31
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.

Expose docs_to_index from GeoBlacklightHarvester

1 participant