Maybe you'd be better off using a custom search component. instead of a doc transformer. The intent of a doc transformer is, as you've discovered, working on single docs at a time. You want to manipulate the whole response which seems to fit more naturally into a search component. Make sure to put it after the highlight component (i.e. last-components).
Best, Erick On Fri, May 27, 2016 at 6:55 AM, Upayavira <u...@odoko.co.uk> wrote: > In a JSON response, we get this: > > { > "responseHeader": {...}, > "response": { "docs": [...] }, > "highlighting": {...} > ... > } > > I'm assuming that the getProcessedDocuments call would give me the docs: > {} element, whereas I'm after the whole response so I can retrieve the > "highlighting" element. > > Make sense? > > On Fri, 27 May 2016, at 02:45 PM, Mikhail Khludnev wrote: >> Upayavira, >> >> It's not clear what do you mean in "results themselves", perhaps you mean >> SolrDocuments ? >> >> public abstract class ResultContext { >> .. >> public Iterator<SolrDocument> getProcessedDocuments() { >> return new DocsStreamer(this); >> } >> >> On Fri, May 27, 2016 at 4:15 PM, Upayavira <u...@odoko.co.uk> wrote: >> >> > Yes, I've seen that. I can see the getDocList() method will presumably >> > give me the results themselves, but I need the full response so I can >> > get the highlighting details, but I can't see them anywhere. >> > >> > On Thu, 26 May 2016, at 09:39 PM, Mikhail Khludnev wrote: >> > > public abstract class ResultContext { >> > > >> > > /// here are all results >> > > public abstract DocList getDocList(); >> > > >> > > public abstract ReturnFields getReturnFields(); >> > > >> > > public abstract SolrIndexSearcher getSearcher(); >> > > >> > > public abstract Query getQuery(); >> > > >> > > public abstract SolrQueryRequest getRequest(); >> > > >> > > On Thu, May 26, 2016 at 11:25 PM, Upayavira <u...@odoko.co.uk> wrote: >> > > >> > > > Hi Mikhail, >> > > > >> > > > Is there really? If I look at ResultContext, I see it is an abstract >> > > > class, completed by BasicResultContext. I don't see any context method >> > > > there. I can see a getContext() on SolrQueryRequest which just returns >> > a >> > > > hashmap. Will I find the response in there? Is that what you are >> > > > suggesting? >> > > > >> > > > Upayavira >> > > > >> > > > On Thu, 26 May 2016, at 06:28 PM, Mikhail Khludnev wrote: >> > > > > Hello, >> > > > > >> > > > > There is a protected ResultContext field named context. >> > > > > >> > > > > On Thu, May 26, 2016 at 5:31 PM, Upayavira <u...@odoko.co.uk> wrote: >> > > > > >> > > > > > Looking at the code for a sample DocTransformer, it seems that a >> > > > > > DocTransformer only has access to the document itself, not to the >> > whole >> > > > > > results. Because of this, it isn't possible to use a >> > DocTransformer to >> > > > > > merge, for example, the highlighting results into the main >> > document. >> > > > > > >> > > > > > Am I missing something? >> > > > > > >> > > > > > Upayavira >> > > > > > >> > > > > >> > > > > >> > > > > >> > > > > -- >> > > > > Sincerely yours >> > > > > Mikhail Khludnev >> > > > > Principal Engineer, >> > > > > Grid Dynamics >> > > > > >> > > > > <http://www.griddynamics.com> >> > > > > <mkhlud...@griddynamics.com> >> > > > >> > > >> > > >> > > >> > > -- >> > > Sincerely yours >> > > Mikhail Khludnev >> > > Principal Engineer, >> > > Grid Dynamics >> > > >> > > <http://www.griddynamics.com> >> > > <mkhlud...@griddynamics.com> >> > >> >> >> >> -- >> Sincerely yours >> Mikhail Khludnev >> Principal Engineer, >> Grid Dynamics >> >> <http://www.griddynamics.com> >> <mkhlud...@griddynamics.com>