Yes, it is exactly what I'm using. But it seems to work only if there isn't a group parameter in the request, otherwise getQuery() is returning null pointer. Do you think it is a bug?
Il giorno mer 23 mar 2016 alle ore 20:09 Ryan McKinley <[email protected]> ha scritto: > Can you use the ResultContext#getQuery()? > > https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/response/ResultContext.java#L42 > > This will get passed to you from: > DockTransformer#setContext() > > https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/response/transform/DocTransformer.java#L48 > > ryan > > > On Wed, Mar 23, 2016 at 10:56 AM, Zaccheo Bagnati <[email protected]> > wrote: > >> Hi all, >> I'm trying to develop a custom DocumentTransformer in SOLR but I'm not >> able to retrieve the Query object when the request is executed with >> group=true. >> Let me explain more in detail: >> the purpose of this Transformer is to apply highlight on a field, extract >> some information from the highlighted field and set those information in >> the result. >> To use Highlighter I need the Query. I can obtain it using >> context.getQuery() in the implementation of transform() method and this is >> working BUTunfortunately, when the request contains some grouping >> parameters (group=true&group.field=...), getQuery() returns a null pointer. >> I ended up in re-parsing the query with >> QParser.getParser(context.getRequest().getParams().get("q"),...) >> but I wonder if there is a better way. >> I'm pretty new in SOLR developing so maybe I'm missing something >> obvious... >> Thank you in advance. >> > >
