开发者

show directly "did you mean results" at drupal solr

开发者 https://www.devze.com 2023-02-16 18:40 出处:网络
I use drupal with Solr integration. When 开发者_开发百科someone searches something in solr and gets no results, but only a \"did you mean\" hint, i would like that the user takes directly the did you

I use drupal with Solr integration.

When 开发者_开发百科someone searches something in solr and gets no results, but only a "did you mean" hint, i would like that the user takes directly the did you mean results, so to save on cliks.

How can I do that?

thanks


The "cleanest" way would be to create your own version of apachesolr_search_view() Which is the the function that generates the search response for the user. in that function you have the conditionals for no results etc.

If you don't want to dig that deep, and believe me the above a lot of work. You can kinda cheat and override the theme_apachesolr_search_noresults() (around line 1493 in apachesolr_search.module, or any other theme override and use the spellcheck results from the $response object in a drupal_goto().

The code the generates the link is around line 1163 in the apachesolr_search.module.

The first approach is preferable from a performance standpoint, but doing the redirect at the theme level is much faster to implement and will most likely not produce a significant speed hit.

0

精彩评论

暂无评论...
验证码 换一张
取 消