[
https://issues.apache.org/jira/browse/SOLR-11765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Owen updated SOLR-11765:
----------------------------
Description:
This is an extension to the JSON facet functionality, to support faceting on a
function. I have extended the parsing of json.facet to allow a 4th facet type
(function) and you provide a function expression. You can also provide sort,
limit and mincount, as it behaves similarly to faceting on a field. Subfacets
work as normal - you can nest function facets anywhere you can use other types.
The output is in the same format as field facets, but with a bucket per
distinct value produced by the function. Hence the usage of this is most
appropriate for situations where your function only produces a relatively small
number of possible values. It's also recommended to have docValues on any field
used by the function.
Our initial use-case for this is with a function that extracts a given part
from a date field's value e.g. day of week, or hour of day, where the possible
range of output values is very low.
Still TODO: documentation, unit tests, and possible extensions to support a
missing bucket and functional sorting (currently it's only sortable by the
bucket label or by volume)
Example usage:
{noformat}
{ facet : { dayOfWeek : { type : function, f :
"chronofield(my_date_field,DAY_OF_WEEK)", sort : "count desc" } } }
{noformat}
I did some refactoring in the facet parser, to hoist some common code for sort
and pagination parsing.
was:
This is an extension to the JSON facet functionality, to support faceting on a
function. I have extended the parsing of json.facet to allow a 4th facet type
(function) and you provide a function expression. You can also provide sort,
limit and mincount, as it behaves similarly to faceting on a field. Subfacets
work as normal - you can nest function facets anywhere you can use other types.
The output is in the same format as field facets, but with a bucket per
distinct value produced by the function. Hence the usage of this is most
appropriate for situations where your function only produces a relatively small
number of possible values. It's also recommended to have docValues on any field
used by the function.
Our initial use-case for this is with a function that extracts a given part
from a date field's value e.g. day of week, or hour of day, where the possible
range of output values is very low.
Still TODO: documentation, unit tests, and possible extensions to support a
missing bucket and functional sorting (currently it's only sortable by the
bucket label or by volume)
Example usage:
{ facet : { dayOfWeek : { type : function, f :
"chronofield(my_date_field,DAY_OF_WEEK)", sort : "count desc" } } }
I did some refactoring in the facet parser, to hoist some common code for sort
and pagination parsing.
> Ability to Facet on a Function
> ------------------------------
>
> Key: SOLR-11765
> URL: https://issues.apache.org/jira/browse/SOLR-11765
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Components: Facet Module, JSON Request API
> Reporter: Tim Owen
> Attachments: SOLR-11765.patch
>
>
> This is an extension to the JSON facet functionality, to support faceting on
> a function. I have extended the parsing of json.facet to allow a 4th facet
> type (function) and you provide a function expression. You can also provide
> sort, limit and mincount, as it behaves similarly to faceting on a field.
> Subfacets work as normal - you can nest function facets anywhere you can use
> other types.
> The output is in the same format as field facets, but with a bucket per
> distinct value produced by the function. Hence the usage of this is most
> appropriate for situations where your function only produces a relatively
> small number of possible values. It's also recommended to have docValues on
> any field used by the function.
> Our initial use-case for this is with a function that extracts a given part
> from a date field's value e.g. day of week, or hour of day, where the
> possible range of output values is very low.
> Still TODO: documentation, unit tests, and possible extensions to support a
> missing bucket and functional sorting (currently it's only sortable by the
> bucket label or by volume)
> Example usage:
> {noformat}
> { facet : { dayOfWeek : { type : function, f :
> "chronofield(my_date_field,DAY_OF_WEEK)", sort : "count desc" } } }
> {noformat}
> I did some refactoring in the facet parser, to hoist some common code for
> sort and pagination parsing.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]