重写/更改WordPress搜索机制 [英] Rewrite/change WordPress search mechanism

查看:126
本文介绍了重写/更改WordPress搜索机制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种改变WordPress搜索机制的方法.我的数据库有几个自定义表,在搜索站点时我要考虑这些表.另外,我不会实现levenshtein函数来提出类似您的意思是[另一个术语]?"这样的语句.当有人犯了拼写错误时.

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.

亲切的问候,

拒绝

推荐答案

您可以通过将您自己的搜索框替换为自定义搜索框,然后调用使用其中一个功能的函数,将WordPress搜索替换为您自己的搜索搜索.这将使您可以替换默认的wordpress搜索,而无需修改核心文件.

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.

三个可能的选择是:

  • MySQL Match Against
  • Sphinx
  • Lucene

我必须为自己的WordPress网站做类似的事情.我最初是与MySQL比赛对抗的,但此后我改用了Sphinx.我遇到了使用MySQL Match的严重速度问题,尽管当我切换到Sphinx时这些问题消失了.

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.

这篇关于重写/更改WordPress搜索机制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆