简体   繁体   English

PHP搜索MySQL数据库框架

[英]PHP Search MySQL Database Framework

I'm sure this question has been asked at least 1000 times, but please hear me out. 我确定这个问题已被问到至少1000次,但请听我说。

I have written a PHP script for MySQL which is used to search through books which are for sale on my book exchange site. 我已经为MySQL编写了一个PHP脚本,用于搜索我的图书交换网站上出售的书籍。 I used this tutorial to help me write a FULLTEXT search script, and it works great, for the most part. 我使用本教程帮助我编写了一个FULLTEXT搜索脚本,它在大多数情况下都很有用。 There are two real big issues that have me and some of my users cringing: 有两个真正的大问题让我和我的一些用户畏缩:

  1. If I search for a particular merchant by name, say, Steve Miller the script will return all people with the name of Steve Miller , first name of Steve , and last name of Miller . 如果我搜索一个特定商家的名字,比如, Steve Miller的剧本将返回所有的人的名字Steve Miller的名字Steve ,和姓Miller As you can imagine, the script returns quite a few bogus results. 你可以想象,该脚本会返回一些虚假的结果。 It gets even worse with common words in book titles, such as of or the , but it doesn't return all books containing these words. 书籍标题中常见的单词会更糟糕,例如of或者the ,但它不会返回包含这些单词的所有书籍。
  2. I have an auto-suggest feature which can only suggest titles when you have entered entire words. 我有一个自动建议功能,只能在您输入整个单词时建议标题。 For example searching for The Unive can't suggest anything, while The Universe can suggest The Universe Next Door . 例如,搜索The Unive不能提出任何建议,而The Universe可以建议The Universe Next Door

Question: Are there any well established scripts or frameworks which allow me to search withing multiple relations in a MySQL database? 问题:是否有任何完善的脚本或框架允许我在MySQL数据库中搜索多个关系? I can't use something like Google Custom Search, since I am searching though particular relations and foreign key relationships in a database, not the whole site. 我不能使用谷歌自定义搜索之类的东西,因为我在数据库中搜索特定关系和外键关系,而不是整个站点。

Thank you for your time. 感谢您的时间。

I have decided to use IndexDen as a search for MySQL data. 我决定使用IndexDen作为MySQL数据的搜索。 They have a PHP API class which enables you to send data which you can specifically format the fit the structure of you database, and use their service to search through specific "attributes" in data you send it. 它们有一个PHP API类,使您可以发送数据,您可以专门格式化数据库的结构,并使用它们的服务搜索发送数据的特定“属性”。

They also offer nice auto-completion services. 他们还提供良好的自动完成服务。

It seems like your auto suggest is backwards and it should be producing the opposite results. 看起来你的汽车建议是倒退的,它应该产生相反的结果。 When someone types The Univ it should return The Universe Next Door - that's what auto suggest/complete is for. 当有人输入The Univ时,它应该返回隔壁的宇宙 - 这就是自动建议/完成的目的。 And as far as issue #1. 至于问题#1。 There's a certain quiet knowledge if you will that if someone is searching, they will continue to enter in characters until the result they are looking for appears. 有一些安静的知识如果你愿意,如果有人正在搜索,他们将继续输入字符,直到他们正在寻找的结果出现。 If in fact they are looking for just "Steve" then they want to know all the references to "Steve" or they are just lazy. 如果事实上他们只是在寻找“史蒂夫”,那么他们想知道所有对“史蒂夫”的提及,或者他们只是懒惰。 If they type Steve Mill, then it should return Steve Mill as well as Steve Miller but not Steve Milworks, because the first name matches but the user is looking for a little more specific than just Steve. 如果他们输入史蒂夫·米尔,那么它应该归还史蒂夫·米尔以及史蒂夫·米勒而不是史蒂夫·米尔史密斯,因为名字匹配,但用户正在寻找比史蒂夫更具体的一点。 They want Steve Mill and because the first 4 characters of the last name are entered and do not match Steve Milw - then Steve Milwork shouldn't be returned.... Make sense? 他们想要史蒂夫·米尔,因为姓氏的前4个字符已经输入而且与史蒂夫·米尔不匹配 - 那么史蒂夫·米尔弗特不应该被退回....有意义吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM