Closed (fixed)
Project:
Apache Solr Views
Version:
6.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 May 2010 at 17:03 UTC
Updated:
28 Aug 2010 at 18:12 UTC
I needed to allow users to sort results by the number of bookmark flags. I implemented hook_apachesolr_update_index() and hook_apachesolr_prepare_query() to get Solr to index this information and present it as sort option, but still needed to integrate this sort with Views. I did it with the attached patch, which obviously should not be incorporated into this module, but might serve as useful sample code for anyone else needing to implement a custom sort. If there's a better way to extend this module by implementing hooks in a custom module, I'd love to hear it, but this works for me.
| Comment | File | Size | Author |
|---|---|---|---|
| apachesolr_views.patch | 2.67 KB | mvc |
Comments
Comment #1
Scott Reynolds commentedGood news is you don't have to do it this way. This is the proper way to do it.
and apachesolr_views_field_generic is going away eventually, it was a first pass at creating solid field support (and it doesn't at all effect this patch).
Comment #2
mvcthat works perfectly. thanks, i'll close this.
i wrote up how we used your module here: http://www.koumbit.org/en/node/15808
Comment #3
Scott Reynolds commentedExcellent, should be noted, that with a recent commit, this is now changed to:
The Views table has now been update to reflect entities that are indexed through Solr. See #576286: Add general SQL support
Comment #5
jpdaut commentedI have implemented hook_apachesolr_update_index(), hook_apachesolr_prepare_query() and hook_views_data_alter() in a small module. However when I select my new sort option in Views and click Update I invariably get: "The Apache Solr search engine is not available." and I can't do any search after that. Does anyone have any clue on what the problem could be?
Comment #6
jpdaut commentedNever mind. I reverted back to my last backup which works.