Rewrite/change WordPress search mechanism

倾然丶 夕夏残阳落幕 提交于 2019-12-11 16:05:50

问题


I've been looking for a way to change the WordPress searching mechanism. My database has several custom tables, which I want to take into account when searching the site. Also, I wan't to implement a levenshtein function for coming up with lines like "Did you mean [another term]?" when somebody makes a spelling error.

Is there a hook, action or function I can implement or change to allow these kind of functions? Any help is greatly appreciated.

Kind regards,

Reinder


回答1:


You could just replace the WordPress search with your own search, by replacing your own search box with a custom search box which then calls a function which uses one of these searches. This will allow you to replace the default wordpress search without modifying the core files.

Three possible options would be:

  • MySQL Match Against
  • Sphinx
  • Lucene

I had to do a similar thing for my own WordPress site. I originally went with MySQL match against, but I have since switched to Sphinx. I ran into serious speed issues using MySQL match against, although those problems vanished when I switched to Sphinx.



来源:https://stackoverflow.com/questions/5538098/rewrite-change-wordpress-search-mechanism

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!