Php 在进行mysql查询之前如何识别stopwords
我正在尝试设置Web应用程序的文本搜索。我的mysql查询如下:Php 在进行mysql查询之前如何识别stopwords,php,javascript,mysql,full-text-search,Php,Javascript,Mysql,Full Text Search,我正在尝试设置Web应用程序的文本搜索。我的mysql查询如下: 从t1中选择*,其中(c1、c2、c3)与(:布尔模式下的keyStr)匹配 我希望:keyStr中的所有单词都匹配,因此keyStr看起来像: :keyStr='+字[0]*+字[1]*+字[2]*++单词[n]*' 如果任何单词[x]是停止字或小于最小字长,则查询返回空值。我认为最好的解决方案是从停止字中删除“+”或完全从:keyStr中删除停止字 有什么好办法吗?在进行查询之前,我是否需要检查stopwords\u列表中是否
从t1中选择*,其中(c1、c2、c3)与(:布尔模式下的keyStr)匹配
我希望:keyStr中的所有单词都匹配,因此keyStr看起来像:
:keyStr='+字[0]*+字[1]*+字[2]*++单词[n]*'
如果任何单词[x]是停止字或小于最小字长,则查询返回空值。我认为最好的解决方案是从停止字中删除“+”或完全从:keyStr中删除停止字
有什么好办法吗?在进行查询之前,我是否需要检查stopwords\u列表中是否有单词[x]?使用javascript实现这一点的简单方法是:
var apart = "Some +example search that I made up".toLowerCase().replace(/[\+\-\?]*/g, '').split(' '),
stop_words = ['the', 'that', 'a', 'example'],
min_word_length = 1;
// filter the array to remove stop words
apart.filter( function( item ) {
if ( item.length < min_word_length ) return false;
return stop_words.indexOf( item ) === -1;
});
使用javascript实现这一点的简单方法是:
var apart = "Some +example search that I made up".toLowerCase().replace(/[\+\-\?]*/g, '').split(' '),
stop_words = ['the', 'that', 'a', 'example'],
min_word_length = 1;
// filter the array to remove stop words
apart.filter( function( item ) {
if ( item.length < min_word_length ) return false;
return stop_words.indexOf( item ) === -1;
});
但我不想禁用停止字,但我不想禁用停止字这会起作用。但是,mysql已经在对照停止字列表检查每个字,并检查最小字长。在客户端检查stopwords似乎是我做了两次工作。这会起作用的。但是,mysql已经在对照停止字列表检查每个字,并检查最小字长。在客户端检查stopwords似乎是我做了两次工作。