{"action":"created","issue":{"url":"https://api.github.com/repos/traject/traject/issues/102","labels_url":"https://api.github.com/repos/traject/traject/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/traject/traject/issues/102/comments","events_url":"https://api.github.com/repos/traject/traject/issues/102/events","html_url":"https://github.com/traject/traject/pull/102","id":77880537,"number":102,"title":"When Indexer#process is called with a block, yield the transformed document, allowing #process to be transformed into an enumerable","user":{"login":"cbeer","id":111218,"avatar_url":"https://avatars.githubusercontent.com/u/111218?v=3","gravatar_id":"","url":"https://api.github.com/users/cbeer","html_url":"https://github.com/cbeer","followers_url":"https://api.github.com/users/cbeer/followers","following_url":"https://api.github.com/users/cbeer/following{/other_user}","gists_url":"https://api.github.com/users/cbeer/gists{/gist_id}","starred_url":"https://api.github.com/users/cbeer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbeer/subscriptions","organizations_url":"https://api.github.com/users/cbeer/orgs","repos_url":"https://api.github.com/users/cbeer/repos","events_url":"https://api.github.com/users/cbeer/events{/privacy}","received_events_url":"https://api.github.com/users/cbeer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-19T01:19:14Z","updated_at":"2015-05-19T18:46:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/traject/traject/pulls/102","html_url":"https://github.com/traject/traject/pull/102","diff_url":"https://github.com/traject/traject/pull/102.diff","patch_url":"https://github.com/traject/traject/pull/102.patch"},"body":"I'd like to write a wrapper around `Traject#Indexer` that provides `Enumerable` methods, but I'm having trouble figuring out how to do that with just the Writer API. Ideally, I want to work with traject like, e.g.:\r\n\r\n```\r\nMyTrajectIndexer.new(io).select { }.reject { }.each do |record|\r\n  # do something\r\nend\r\n```\r\n\r\nI wasn't sure if, when a block is provided, it should ignore the writer entirely or not. I decided to just support both, and, for my purposes, make the writer a no-op, but happy to do it the other way instead.\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/traject/traject/issues/comments/103628347","html_url":"https://github.com/traject/traject/pull/102#issuecomment-103628347","issue_url":"https://api.github.com/repos/traject/traject/issues/102","id":103628347,"user":{"login":"billdueber","id":114006,"avatar_url":"https://avatars.githubusercontent.com/u/114006?v=3","gravatar_id":"","url":"https://api.github.com/users/billdueber","html_url":"https://github.com/billdueber","followers_url":"https://api.github.com/users/billdueber/followers","following_url":"https://api.github.com/users/billdueber/following{/other_user}","gists_url":"https://api.github.com/users/billdueber/gists{/gist_id}","starred_url":"https://api.github.com/users/billdueber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billdueber/subscriptions","organizations_url":"https://api.github.com/users/billdueber/orgs","repos_url":"https://api.github.com/users/billdueber/repos","events_url":"https://api.github.com/users/billdueber/events{/privacy}","received_events_url":"https://api.github.com/users/billdueber/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T18:46:41Z","updated_at":"2015-05-19T18:46:41Z","body":"[The change](https://github.com/cbeer/traject/blob/process-block/lib/traject/indexer.rb#L433-L443) all takes place within a block passed to the thread pool, so it should be safe. Even mucking about with the context should be fine, since it's straight-line computation on a single context within a single thread. I'm still trying to think through how pulling the context-creation/filling into a dedicated `#each` would be affected by threading; I may have to implement it just to get straight what I'm thinking. "}}