Posted by Anonymous on April 28, 2012 at 5:21pm
I have a site that is using SOLR search with just a couple facets. The filter by type facet works for my needs out of the box without much adjustment. However, I need to change the markup of the 'sort by' facet to be a 'select' list rather than a unordered list to match the design.
I have been searching for a solution to this, but have yet to find one. The site is in D7 w apachesolr 7.x-1.0-beta16.
Any help would be greatly appreciated.
-Jeff
Comments
What type of facets do you
What type of facets do you have? Are they defined as terms of one or more Taxonomy vocabularies? Can you provide a partial example?
thanks for the response Bob.
thanks for the response Bob. I have a filter by content type facet and the standard sort by facet. The sort by facet is the one that I need to alter.
The sort by facet is the block to sort by relevancy, title, type, author or date.
On this site, you can see the facet that I'm speaking of just above the search box. http://www.powderbulksolids.com/search/site/powder
Thanks!
-Jeff
Jeff, You may want to consult
Jeff,
You may want to consult Facet API (http://drupal.org/project/facetapi) and its documentation (http://www.trellon.com/content/blog/apachesolr-and-facetapi).
On the other hand, if it were me in charge of the UX -- and if the facets will remain Relevance, Title, Type, Author, Date -- I would keep their presentation just as it is.
Bob
Facet API doesn't handle sorting
Facet API doesn't create or manage the sorting block, so its documentation won't be any help here. Sorts are not really facets, so generally that functionality is handled by the underlying search module, i.e. Apache Solr Search Integration or Search API.
thanks for the help Bob...I
thanks for the help Bob...I too wish the presentation could stay the same. sigh, oh well.
much appreciated.
Unfortunately this isn't as
Unfortunately this isn't as simple as tweaking the sort block to display as a select list as opposed to links :-(. Because the links add the sort information to the query string, the solution is that you will have to create a block in a custom module, copy some of the logic to get the sorting information, build a form via Drupal's FAPI, and then implement a submit handler that redirects to a URL structured in the same way as as the links. I have some code that I will post to a sandbox in a few minutes.
Code has been posted to the
Code has been posted to the Apache Solr Select Sort sandbox. The display probably needs to be tweaked, but it is a starting point. I don't plan on maintaining this module, so if you want to make modifications and maintain it I am perfectly willing to go down that road.
thanks much for the help
thanks much for the help guys...I will take a look at the code.
Cross posting to Apache Solr Search Integration issue
http://drupal.org/node/1001652
Functionality merged into Apachesolr Sort
The sandbox project I posted implementing this functionality has been merged into Apachesolr Sort.