[xwiki-devs] Support for custom facets in Solr search
Hello there, I'd like to try to limit/customize the shown facets in the refinement panel for the Solr search. This would allow for a custom search page with different facet fields than the standard search (e.g. the facet "page" or "date" might not be useful in every case) or the addition of custom facet fields, for example "tags". Instead of modifying the global defaults in solrconfig.xml, I'd want to name the desired facet fields in the concrete solr query. Like documented for example in http://wiki.apache.org/solr/SimpleFacetParameters#Examples, if I want both fields "cat" and "inStock", I need to add both fieldnames to the query for the parameter "facet.field". On the Solr side, the set(String, String[]) method (http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/common/params...) could be used for this. However, the current SolrQueryExecutor implementation does not support this "multiple arguments" case, so for example a $query.bindValue('facet.field', ["cat", "inStock"])) doesn't work. To solve this problem, I suggest that SolrQueryExecutor.execute() checks each value of the named parameters for a list and optionally calls set(String, String[]) instead of set(String, String). I'd gladly supply a patch for this issue. Is there any interest in this? Sincerely, Martin Kresse -- Martin Kresse Anwendungsentwicklung EsPresto AG Breite Str. 30-31 10178 Berlin/Germany Tel: +49.(0)30.90 226.750 Fax: +49.(0)30.90 226.760 [email protected] HRB 77554 B - Berlin-Charlottenburg Vorstand: Maya Biersack, Peter Biersack Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber Zertifiziert nach ISO 9001:2008
On Fri, Aug 30, 2013 at 1:01 PM, Martin Kresse <[email protected]> wrote:
Hello there,
I'd like to try to limit/customize the shown facets in the refinement panel for the Solr search. This would allow for a custom search page with different facet fields than the standard search (e.g. the facet "page" or "date" might not be useful in every case) or the addition of custom facet fields, for example "tags".
Instead of modifying the global defaults in solrconfig.xml, I'd want to name the desired facet fields in the concrete solr query. Like documented for example in http://wiki.apache.org/solr/SimpleFacetParameters#Examples, if I want both fields "cat" and "inStock", I need to add both fieldnames to the query for the parameter "facet.field". On the Solr side, the set(String, String[]) method (http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/common/params...) could be used for this. However, the current SolrQueryExecutor implementation does not support this "multiple arguments" case, so for example a $query.bindValue('facet.field', ["cat", "inStock"])) doesn't work.
To solve this problem, I suggest that SolrQueryExecutor.execute() checks each value of the named parameters for a list and optionally calls set(String, String[]) instead of set(String, String). I'd gladly supply a patch for this issue. Is there any interest in this?
Sounds good to me, if you provide such a pull request I will apply it or I can take care of this if you prefer.
Sincerely, Martin Kresse
-- Martin Kresse Anwendungsentwicklung EsPresto AG Breite Str. 30-31 10178 Berlin/Germany Tel: +49.(0)30.90 226.750 Fax: +49.(0)30.90 226.760 [email protected]
HRB 77554 B - Berlin-Charlottenburg Vorstand: Maya Biersack, Peter Biersack Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber Zertifiziert nach ISO 9001:2008
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
Am 30.08.2013 15:21, schrieb Thomas Mortagne:
On Fri, Aug 30, 2013 at 1:01 PM, Martin Kresse <[email protected]> wrote:
Hello there,
I'd like to try to limit/customize the shown facets in the refinement panel for the Solr search. This would allow for a custom search page with different facet fields than the standard search (e.g. the facet "page" or "date" might not be useful in every case) or the addition of custom facet fields, for example "tags".
Instead of modifying the global defaults in solrconfig.xml, I'd want to name the desired facet fields in the concrete solr query. Like documented for example in http://wiki.apache.org/solr/SimpleFacetParameters#Examples, if I want both fields "cat" and "inStock", I need to add both fieldnames to the query for the parameter "facet.field". On the Solr side, the set(String, String[]) method (http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/common/params...) could be used for this. However, the current SolrQueryExecutor implementation does not support this "multiple arguments" case, so for example a $query.bindValue('facet.field', ["cat", "inStock"])) doesn't work.
To solve this problem, I suggest that SolrQueryExecutor.execute() checks each value of the named parameters for a list and optionally calls set(String, String[]) instead of set(String, String). I'd gladly supply a patch for this issue. Is there any interest in this? Sounds good to me, if you provide such a pull request I will apply it or I can take care of this if you prefer.
Great, I will provide a pull request on monday. Have a nice weekend, Martin -- Martin Kresse Anwendungsentwicklung EsPresto AG Breite Str. 30-31 10178 Berlin/Germany Tel: +49.(0)30.90 226.750 Fax: +49.(0)30.90 226.760 [email protected] HRB 77554 B - Berlin-Charlottenburg Vorstand: Maya Biersack, Peter Biersack Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber Zertifiziert nach ISO 9001:2008
Am 30.08.2013 15:21, schrieb Thomas Mortagne:
On Fri, Aug 30, 2013 at 1:01 PM, Martin Kresse <[email protected]> wrote:
Hello there,
I'd like to try to limit/customize the shown facets in the refinement panel for the Solr search. This would allow for a custom search page with different facet fields than the standard search (e.g. the facet "page" or "date" might not be useful in every case) or the addition of custom facet fields, for example "tags".
Instead of modifying the global defaults in solrconfig.xml, I'd want to name the desired facet fields in the concrete solr query. Like documented for example in http://wiki.apache.org/solr/SimpleFacetParameters#Examples, if I want both fields "cat" and "inStock", I need to add both fieldnames to the query for the parameter "facet.field". On the Solr side, the set(String, String[]) method (http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/common/params...) could be used for this. However, the current SolrQueryExecutor implementation does not support this "multiple arguments" case, so for example a $query.bindValue('facet.field', ["cat", "inStock"])) doesn't work.
To solve this problem, I suggest that SolrQueryExecutor.execute() checks each value of the named parameters for a list and optionally calls set(String, String[]) instead of set(String, String). I'd gladly supply a patch for this issue. Is there any interest in this? Sounds good to me, if you provide such a pull request I will apply it or I can take care of this if you prefer.
JIRA: https://jira.xwiki.org/browse/XWIKI-9413 PR: https://github.com/xwiki/xwiki-platform/pull/145 -- Martin Kresse Anwendungsentwicklung EsPresto AG Breite Str. 30-31 10178 Berlin/Germany Tel: +49.(0)30.90 226.750 Fax: +49.(0)30.90 226.760 [email protected] HRB 77554 B - Berlin-Charlottenburg Vorstand: Maya Biersack, Peter Biersack Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber Zertifiziert nach ISO 9001:2008
participants (2)
-
Martin Kresse -
Thomas Mortagne