Specifically, I'm referring to being able to have the top 5 search results display as options in a drop down menu while the user types in a search query, somewhat similar to how node reference autocomplete works. It would be great to have such functionality work with Apachesolr.
-
What you describe is not live-search, but automcompleting search suggestions.– berkesCommented May 10, 2011 at 11:28
-
Autocomplete Search Suggestions is already an existing solution, which I described as being what Apachesolr_autocomplete provides. I'm looking for something that provides the top 5 search results for the current search phrase in an Ajax drop down menu.– DanHCommented May 11, 2011 at 6:56
3 Answers
Depending on your needs, there are a couple of solutions. Probably the closest thing to Apple's Live Search feature is the Finder module. It does not integrate with Apache Solr at this time, however.
I would also keep your eye on the Inline Ajax Search module as Solr integration is on the roadmap. It might need some contributions to push integration through.
A third solution to try is the Apache Solr AJAX module. It might not fit exactly what you are trying to do, however it allows for inline refreshing of the page when queries are entered and filters are enabled.
Acquia offers a solution built on Solr. http://network.acquia.com/services/acquia-search
-
Hmmm this looks cool, but, the project I'm working on is heavily reliant on Pressflow, so I'm guessing anything acquia built is not going to be compatible?– DanHCommented May 13, 2011 at 16:32
-
Pressflow is just a distribution of Drupal (a profile), which means it's just adding on modules, themes, content types and views in a bundle. The base is still Drupal. Solr should still work fine. Commented May 17, 2011 at 23:45
-
Oh ok I'll give it a try thanks. I thought that Acquia provided some base modules that required registering and paying, and assumed they might be Acquia locked. I guess I should be more adventurous :)– DanHCommented May 18, 2011 at 14:43
-
I work for Acquia, and I want to reiterate that Acquia doesn't build modules with secret functionality that you have to pay for. The value of Acquia Search is a fully managed, enterprise-grade, scalable Solr instance, but there isn't any additional functionality beyond what the Apache Solr Search Integration module provides. In addition, any module that works with Apache Solr Search Integration will work with Acquia Search. Commented Jul 16, 2011 at 20:58
I would suggest installing the module http://drupal.org/project/apachesolr_autocomplete, this out of the box will let you see Solr's keyword suggestions.
The next issue is showing nodes in the search results and not search terms, there is a hook called apachesolr_modify_query($query,'apachesolr_autocomplete');
which will allow you to write a custom module to intercept the query as it goes to Solr and tell it to search for nodes and not search suggestions.
The remaining problem you have is simply down to theming the search results so that they look like the regular search.
There already are two theming functions avaliable:
- theme_apachesolr_autocomplete_highlight
- theme_apachesolr_autocomplete_spellcheck
Hope this helps.
At the end of the day you could write the entire module yourself without starting with the base module apachesolr_autocomplete, but I feel it takes a lot of the heavy lifting off you and would be an advantage.