lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joel Bernstein (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SOLR-4465) Configurable Collectors
Date Thu, 21 Mar 2013 15:33:16 GMT

     [ https://issues.apache.org/jira/browse/SOLR-4465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Joel Bernstein updated SOLR-4465:
---------------------------------

    Description: 
This ticket provides a patch to add pluggable collectors to Solr. This patch was generated
and tested with Solr 4.1.

This is how the patch functions:

Collectors are plugged into Solr in the solconfig.xml using the new collectorFactory element.
For example:

<collectorFactory name="default" class="solr.CollectorFactory"/>
<collectorFactory name="sum" class="solr.SumCollectorFactory"/>

The elements above define two collector factories. The first one is the "default" collectorFactory.
The class attribute points to org.apache.solr.handler.component.CollectorFactory, which implements
logic that returns the default TopScoreDocCollector and TopFieldCollector. 

To create your own collectorFactory you must subclass the default CollectorFactory and at
a minimum override the getCollector method to return your new collector. 


The parameter "cl" turns on pluggable collectors:

cl=true

If cl is not in the parameters, Solr will automatically use the default collectorFactory.


*Pluggable doclist Sorting with Topdocs Collectors*


You can specify two types of pluggable collectors. The first type is the topdocs collector.
For example:

cl.topdocs=<name>

The above param points to the named collectorFactory in the solrconfig.xml to construct the
collector. Topdocs collectorFactorys must return collectors that extend the TopDocsCollector
base class. Topdocs collectors are responsible for collecting the doclist.

You can pass parameters to the topdocs collector using local params syntax. For example:

cl.topdocs=\{! sort=mycustomesort\}mycollector

*Pluggable Custom Analytics With Delegating Collectors*

You can also specify any number of delegating collectors with the "cl.delegating" parameter.
Delegating collectors are designed to collect something else besides the doclist. Typically
this would be some type of custom analytic. 

cl.delegating=sum

The parameter above specifies a delegating collector named sum. Like the topdocs collectors,
"sum" points to the named collectorFactories in the solrconfig.xml. You can specificy more
delegating collectors by adding additional cl.delegating parameters.

Delegating collector factories must return Collector instances that extend DelegatingCollector.


A sample delegating collector is provided in the patch through the org.apache.solr.handler.component.SumCollectorFactory.

This collectorFactory provides a very simple DelegatingCollector that groups by a field and
sums a column of floats. The sum collector is not designed to be a fully functional sum function
but to be a proof of concept for pluggable analytics through delegating collectors.

You can send parameters to the delegating collectors with solr local param syntax.

For example:

cl.delegating=\{! id=1 groupby=field1 column=field2\}sum

The "id" parameter is mandatory for delegating collectors and used to identify the output
from the collector. In this example the "groupby" and "column" params tell the sum collector
which field to groupon and sum.

Delegating collectors are passed a reference to the ResponseBuilder and can place maps with
analytic output directory into the SolrQueryResponse with the add() method.

Maps that are placed in the SolrQueryResponse are automatically added to the outgoing response.
The response will include a list named cl.<id>, where id is specified in the local param.


*Distributed Search*

The CollectorFactory also has a method called merge(). This method aggregates the results
from each of the shards during distributed search. The "default" CollectoryFactory implements
the default merge logic for merging documents from each shard. If you define a different topdocs
collector you can override the default merge method to merge documents in accordance with
how they are collected at the shard level.

With delegating collectors, you'll need to override the merge method to merge the analytic
output from the shards. An example of how this works is provided in the SumCollectorFactory.

Each collectorFactory, that is specified in the http parameters, will have its merge method
applied by the aggregator.

*Testing the Patch With Sample Data*

1) Apply patch to Solr 4.1
2) Load sample data
3) Send the http command:

http://localhost:8983/solr/select?q=*:*&cl=true&facet=true&facet.field=manu_id_s&cl.delegating=\{!+id=%271%27+groupby=%27manu_id_s%27+column=%27price%27\}sum&cl.delegating=\{!+id=%272%27+groupby=%27manu_id_s%27%20column=%27weight%27\}sum











  









  was:
This ticket provides a patch to add pluggable collectors to Solr. This patch was generated
and tested with Solr 4.1.

This is how the patch functions:

Collectors are plugged into Solr in the solconfig.xml using the new collectorFactory element.
For example:

<collectorFactory name="default" class="solr.CollectorFactory"/>
<collectorFactory name="sum" class="solr.SumCollectorFactory"/>

The elements above define two collector factories. The first one is the "default" collectorFactory.
The class attribute points to org.apache.solr.handler.component.CollectorFactory, which implements
logic that returns the default TopScoreDocCollector and TopFieldCollector. 

To create your own collectorFactory you must subclass the default CollectorFactory and at
a minimum override the getCollector method to return your new collector. 


The parameter "cl" turns on pluggable collectors:

cl=true

If cl is not in the parameters, Solr will automatically use the default collectorFactory.


*Pluggable doclist Sorting with Topdocs Collectors*


You can specify two types of pluggable collectors. The first type is the topdocs collector.
For example:

cl.topdocs=<name>

The above param points to the named collectorFactory in the solrconfig.xml to construct the
collector. Topdocs collectorFactorys must return collectors that extend the TopDocsCollector
base class. Topdocs collectors are responsible for collecting the doclist.

You can pass parameters to the topdocs collector using local params syntax. For example:

cl.topdocs={! sort=mycustomesort}mycollector

*Pluggable Custom Analytics With Delegating Collectors*

You can also specify any number of delegating collectors with the "cl.delegating" parameter.
Delegating collectors are designed to collect something else besides the doclist. Typically
this would be some type of custom analytic. 

cl.delegating=sum

The parameter above specifies a delegating collector named sum. Like the topdocs collectors,
"sum" points to the named collectorFactories in the solrconfig.xml. You can specificy more
delegating collectors by adding additional cl.delegating parameters.

Delegating collector factories must return Collector instances that extend DelegatingCollector.


A sample delegating collector is provided in the patch through the org.apache.solr.handler.component.SumCollectorFactory.

This collectorFactory provides a very simple DelegatingCollector that groups by a field and
sums a column of floats. The sum collector is not designed to be a fully functional sum function
but to be a proof of concept for pluggable analytics through delegating collectors.

You can send parameters to the delegating collectors with solr local param syntax.

For example:

cl.delegating=\{! id=1 groupby=field1 column=field2\}sum

The "id" parameter is mandatory for delegating collectors and used to identify the output
from the collector. In this example the "groupby" and "column" params tell the sum collector
which field to groupon and sum.

Delegating collectors are passed a reference to the ResponseBuilder and can place maps with
analytic output directory into the SolrQueryResponse with the add() method.

Maps that are placed in the SolrQueryResponse are automatically added to the outgoing response.
The response will include a list named cl.<id>, where id is specified in the local param.


*Distributed Search*

The CollectorFactory also has a method called merge(). This method aggregates the results
from each of the shards during distributed search. The "default" CollectoryFactory implements
the default merge logic for merging documents from each shard. If you define a different topdocs
collector you can override the default merge method to merge documents in accordance with
how they are collected at the shard level.

With delegating collectors, you'll need to override the merge method to merge the analytic
output from the shards. An example of how this works is provided in the SumCollectorFactory.

Each collectorFactory, that is specified in the http parameters, will have its merge method
applied by the aggregator.

*Testing the Patch With Sample Data*

1) Apply patch to Solr 4.1
2) Load sample data
3) Send the http command:

http://localhost:8983/solr/select?q=*:*&cl=true&facet=true&facet.field=manu_id_s&cl.delegating={!+id=%271%27+groupby=%27manu_id_s%27+column=%27price%27}sum&cl.delegating={!+id=%272%27+groupby=%27manu_id_s%27%20column=%27weight%27}sum











  









    
> Configurable Collectors
> -----------------------
>
>                 Key: SOLR-4465
>                 URL: https://issues.apache.org/jira/browse/SOLR-4465
>             Project: Solr
>          Issue Type: New Feature
>          Components: search
>    Affects Versions: 4.1
>            Reporter: Joel Bernstein
>             Fix For: 4.3
>
>         Attachments: SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch,
SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch,
SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch, SOLR-4465.patch
>
>
> This ticket provides a patch to add pluggable collectors to Solr. This patch was generated
and tested with Solr 4.1.
> This is how the patch functions:
> Collectors are plugged into Solr in the solconfig.xml using the new collectorFactory
element. For example:
> <collectorFactory name="default" class="solr.CollectorFactory"/>
> <collectorFactory name="sum" class="solr.SumCollectorFactory"/>
> The elements above define two collector factories. The first one is the "default" collectorFactory.
The class attribute points to org.apache.solr.handler.component.CollectorFactory, which implements
logic that returns the default TopScoreDocCollector and TopFieldCollector. 
> To create your own collectorFactory you must subclass the default CollectorFactory and
at a minimum override the getCollector method to return your new collector. 
> The parameter "cl" turns on pluggable collectors:
> cl=true
> If cl is not in the parameters, Solr will automatically use the default collectorFactory.
> *Pluggable doclist Sorting with Topdocs Collectors*
> You can specify two types of pluggable collectors. The first type is the topdocs collector.
For example:
> cl.topdocs=<name>
> The above param points to the named collectorFactory in the solrconfig.xml to construct
the collector. Topdocs collectorFactorys must return collectors that extend the TopDocsCollector
base class. Topdocs collectors are responsible for collecting the doclist.
> You can pass parameters to the topdocs collector using local params syntax. For example:
> cl.topdocs=\{! sort=mycustomesort\}mycollector
> *Pluggable Custom Analytics With Delegating Collectors*
> You can also specify any number of delegating collectors with the "cl.delegating" parameter.
Delegating collectors are designed to collect something else besides the doclist. Typically
this would be some type of custom analytic. 
> cl.delegating=sum
> The parameter above specifies a delegating collector named sum. Like the topdocs collectors,
"sum" points to the named collectorFactories in the solrconfig.xml. You can specificy more
delegating collectors by adding additional cl.delegating parameters.
> Delegating collector factories must return Collector instances that extend DelegatingCollector.

> A sample delegating collector is provided in the patch through the org.apache.solr.handler.component.SumCollectorFactory.
> This collectorFactory provides a very simple DelegatingCollector that groups by a field
and sums a column of floats. The sum collector is not designed to be a fully functional sum
function but to be a proof of concept for pluggable analytics through delegating collectors.
> You can send parameters to the delegating collectors with solr local param syntax.
> For example:
> cl.delegating=\{! id=1 groupby=field1 column=field2\}sum
> The "id" parameter is mandatory for delegating collectors and used to identify the output
from the collector. In this example the "groupby" and "column" params tell the sum collector
which field to groupon and sum.
> Delegating collectors are passed a reference to the ResponseBuilder and can place maps
with analytic output directory into the SolrQueryResponse with the add() method.
> Maps that are placed in the SolrQueryResponse are automatically added to the outgoing
response. The response will include a list named cl.<id>, where id is specified in the
local param.
> *Distributed Search*
> The CollectorFactory also has a method called merge(). This method aggregates the results
from each of the shards during distributed search. The "default" CollectoryFactory implements
the default merge logic for merging documents from each shard. If you define a different topdocs
collector you can override the default merge method to merge documents in accordance with
how they are collected at the shard level.
> With delegating collectors, you'll need to override the merge method to merge the analytic
output from the shards. An example of how this works is provided in the SumCollectorFactory.
> Each collectorFactory, that is specified in the http parameters, will have its merge
method applied by the aggregator.
> *Testing the Patch With Sample Data*
> 1) Apply patch to Solr 4.1
> 2) Load sample data
> 3) Send the http command:
> http://localhost:8983/solr/select?q=*:*&cl=true&facet=true&facet.field=manu_id_s&cl.delegating=\{!+id=%271%27+groupby=%27manu_id_s%27+column=%27price%27\}sum&cl.delegating=\{!+id=%272%27+groupby=%27manu_id_s%27%20column=%27weight%27\}sum
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message