Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-9413

Support for custom facets in Solr search API

    XMLWordPrintable

Details

    • Unit
    • Easy
    • N/A

    Description

      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/ModifiableSolrParams.html#set%28java.lang.String,%20java.lang.String...%29)
      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).

      Attachments

        Issue Links

          Activity

            People

              kresse Martin Kresse
              kresse Martin Kresse
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: