Open hoogw opened 6 years ago
google style, - minus means not include, + plus sign means include
aaa -bbb -ccc
means, pages include aaa, but not include bbb, not include ccc
+aaa bbb -ccc
means, pages include aaa AND bbb, but NOT include ccc
also google style, 'bbb aaa' , "bbb aaa"
means, exact string 'bbb aaa' must be match.
Including and Excluding Google Search Terms https://www.lifewire.com/addition-subtraction-in-google-1616814
Ten Tips for Smarter Google Searches http://www.informit.com/articles/article.aspx?p=675274&seqNum=3
自己动手,满足自己需要。
改这个文件。要加个括号。 (topic or tag) AND (topic or tag) AND (topic or tag) controller/search.php
`///$NormalQuery[] = 't.Topic LIKE :Topic' . $ParamName . ' or t.Tags LIKE :Tag' . $ParamName;
$NormalQuery[] = '('.'t.Topic LIKE :Topic' . $ParamName . ' or t.Tags LIKE :Tag' . $ParamName . ')';
...................
.............
.......
...`
另外一个地方 OR 改成 AND
///$Temp = implode(' OR ', $NormalQuery);
$Temp = implode(' AND ', $NormalQuery);
...................
.............
.......
...
改过以后, search “aaa bbb” 无论是tag 还是topic 必须同时有 aaa 和 bbb 的帖子才出现在搜索结果里,和google search一样。
没改之前,search “aaa bbb” 无论是tag 还是topic, 只有aaa,没有bbb的帖子也出现在搜索结果里。这是不符合google search的原则的。
$AdvancedQuery $AdvancedQuery = array();//高级查询条件,用AND连接
请解释一下,这个东西怎么用,和 $NormalQuery = array();//普通查询条件,用OR连接 有什么区别?
我把 $AdvancedSearch = true 怎么不管用,
1) if I search aaa bbb ccc it search for any title OR tag like aaa OR like bbb OR like ccc. SQL = like aaa or like bbb or like ccc
Google search does, AND, means, any title OR tag like aaa AND bbb AND ccc. SQL = like aaa AND like bbb AND like ccc
I feel google style is better, more useful, why, if I google BASS, the result could have fish, gitar, and people.
I only want to see result related to fish, and filter out others. so I search BASS FISH, google will use AND by default, means, BASS AND FISH. it will only show results have both BASS and fish.
If I google BASS -fish, I will filter out all fish related page, means, I don't want to see fish related page, SQL = Like BASS AND not like FISH.
google search style is more useful, it should only need to make change at SQL, or => and