Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.6
Component:
nodereference.module
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
14 Nov 2009 at 17:10 UTC
Updated:
29 Nov 2009 at 12:10 UTC
I would like to use Apache Solr instead of MySQL for the autocomplete feature. I also want to contribute and therefore I need some hints.
The apachesolr_autocomplete module is a big help, but I can't get over the fact that the results are single search terms instead of entire title names.
e.g.: The user types lem
and Solr returns lemon
instead of Lemon Tree
.
Any ideas how to handle this?
Comments
Comment #1
markus_petrux commentedI'm afraid this is food for a separate contrib module. One that could replace the autocomplete path of node reference fields with another one that points to a menu callback that performs the queries against the apache solr backend and returns the results to the client-side transparently.
Comment #2
cpojoni commentedFor this separate module to work, the nodereference.module needs probably a change in
function nodereference_autocomplete_process($element, $edit, $form_state, $form)since
'#autocomplete_path' => 'nodereference/autocomplete/'. $element['#field_name'],is predefined and would we overwritten if another field (or widget?) would wrap it.Wouldn't it be better to test if the value is set like this:
Comment #3
andreiashu commented@cpojoni I'm not really sure what you're trying to do in #2 but I think just overriding the autocomplete path (
'nodereference/autocomplete') in a hook_menu_alter would be sufficient. Then you can have your own callback that returns the proper results.Comment #4
cpojoni commentedChanging the autocomplete path globally would also be an option, of course. Great idea, thanks!