retrieve Query in DocumentTransformer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

retrieve Query in DocumentTransformer

Zaccheo Bagnati
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.
Reply | Threaded
Open this post in threaded view
|

Re: retrieve Query in DocumentTransformer

Ryan McKinley

On Wed, Mar 23, 2016 at 10:56 AM, Zaccheo Bagnati <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: retrieve Query in DocumentTransformer

Zaccheo Bagnati
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 <[hidden email]> ha scritto:

ryan


On Wed, Mar 23, 2016 at 10:56 AM, Zaccheo Bagnati <[hidden email]> 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.