You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by simon <mt...@gmail.com> on 2018/02/27 20:20:51 UTC
Defining Document Transformers in Solr Configuration
We do quite complex data pulls from a Solr index for subsequent analytics,
currently using a home-grown Python API. Queries might include a handful
of pseudofields which this API rewrites to an aliased field invoking a
Document Transformer in the 'fl' parameter list.
For example 'numcites' is transformed to
'fl= ....,numcites:[subquery]&numcites.fl=pmid&numcites.q={!terms
f=md_c_pmid v=$row.pmid}&numcites.rows=10&numcites.logParamsList=q',...'
What I'd ideally like to be able to do would be have this transformation
defined in Solr configuration so that it's not tied to one particular
external API - defining a macro, if you will, so that you could supply
'fl='a,b,c,%numcites%,...' in the request and have Solr do the expansion.
Is there some way to do this that I've overlooked ? if not, I think it
would be a useful new feature.
-Simon
Re: Defining Document Transformers in Solr Configuration
Posted by simon <mt...@gmail.com>.
Thanks Mikhail:
I considered that, but not all queries would request that field, and there
are in fact a couple more similar DocTransformer-generated aliased fields
which we can optionally request, so it's not a general enough solution.
-Simon
On Wed, Feb 28, 2018 at 1:18 AM, Mikhail Khludnev <mk...@apache.org> wrote:
> Hello, Simon.
>
> You can define a search handler where have <appends><str name="fl">
> numcites:[subquery]&numcites.fl=pmid&numcites.q={!terms
> f=md_c_pmid v=$row.pmid}&numcites.rows=10&numcites.logParamsList=q</str>
> </appends>
> or something like that.
>
> On Tue, Feb 27, 2018 at 11:20 PM, simon <mt...@gmail.com> wrote:
>
> > We do quite complex data pulls from a Solr index for subsequent
> analytics,
> > currently using a home-grown Python API. Queries might include a handful
> > of pseudofields which this API rewrites to an aliased field invoking a
> > Document Transformer in the 'fl' parameter list.
> >
> > For example 'numcites' is transformed to
> >
> > 'fl= ....,numcites:[subquery]&numcites.fl=pmid&numcites.q={!terms
> > f=md_c_pmid v=$row.pmid}&numcites.rows=10&numcites.logParamsList=q',...'
> >
> > What I'd ideally like to be able to do would be have this transformation
> > defined in Solr configuration so that it's not tied to one particular
> > external API - defining a macro, if you will, so that you could supply
> > 'fl='a,b,c,%numcites%,...' in the request and have Solr do the expansion.
> >
> > Is there some way to do this that I've overlooked ? if not, I think it
> > would be a useful new feature.
> >
> >
> > -Simon
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>
Re: Defining Document Transformers in Solr Configuration
Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, Simon.
You can define a search handler where have <appends><str name="fl">
numcites:[subquery]&numcites.fl=pmid&numcites.q={!terms
f=md_c_pmid v=$row.pmid}&numcites.rows=10&numcites.logParamsList=q</str></appends>
or something like that.
On Tue, Feb 27, 2018 at 11:20 PM, simon <mt...@gmail.com> wrote:
> We do quite complex data pulls from a Solr index for subsequent analytics,
> currently using a home-grown Python API. Queries might include a handful
> of pseudofields which this API rewrites to an aliased field invoking a
> Document Transformer in the 'fl' parameter list.
>
> For example 'numcites' is transformed to
>
> 'fl= ....,numcites:[subquery]&numcites.fl=pmid&numcites.q={!terms
> f=md_c_pmid v=$row.pmid}&numcites.rows=10&numcites.logParamsList=q',...'
>
> What I'd ideally like to be able to do would be have this transformation
> defined in Solr configuration so that it's not tied to one particular
> external API - defining a macro, if you will, so that you could supply
> 'fl='a,b,c,%numcites%,...' in the request and have Solr do the expansion.
>
> Is there some way to do this that I've overlooked ? if not, I think it
> would be a useful new feature.
>
>
> -Simon
>
--
Sincerely yours
Mikhail Khludnev
Re: Defining Document Transformers in Solr Configuration
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
I am not sure I fully understood the desired transformation, but
perhaps something from https://people.apache.org/~hossman/rev2016/
would help.
I am specifically thinking of:
*) f.person.qf example
*) ${people} example
Regards,
Alex.
On 27 February 2018 at 15:20, simon <mt...@gmail.com> wrote:
> We do quite complex data pulls from a Solr index for subsequent analytics,
> currently using a home-grown Python API. Queries might include a handful
> of pseudofields which this API rewrites to an aliased field invoking a
> Document Transformer in the 'fl' parameter list.
>
> For example 'numcites' is transformed to
>
> 'fl= ....,numcites:[subquery]&numcites.fl=pmid&numcites.q={!terms
> f=md_c_pmid v=$row.pmid}&numcites.rows=10&numcites.logParamsList=q',...'
>
> What I'd ideally like to be able to do would be have this transformation
> defined in Solr configuration so that it's not tied to one particular
> external API - defining a macro, if you will, so that you could supply
> 'fl='a,b,c,%numcites%,...' in the request and have Solr do the expansion.
>
> Is there some way to do this that I've overlooked ? if not, I think it
> would be a useful new feature.
>
>
> -Simon