我在weight
Sphinx 遇到了一个奇怪的问题.仅在执行全文时name
,结果将被准确加权.但是当它通过搜索扩展时address
,计算出的重量是不正确的.
我正在使用 Sphinx 2.2.11
示例1:搜索名称会产生正确的结果
$cl->SetRankingMode(SPH_RANK_SPH04);
$cl->SetSortMode(SPH_SORT_EXTENDED, '@weight desc');
$cl->SetMatchMode(SPH_MATCH_EXTENDED2);
$res = $cl->Query('@name ("la" | "comedie" | "saint" | "michel")', 'idx_name');
Run Code Online (Sandbox Code Playgroud)
产量
Venue Name Address Weight
La Comédie Saint-Michel boulevard Saint-Michel 19620
La Comédie Saint-Michel - Small Hall boulevard Saint-Michel 18649
La Comédie Saint-Michel - Grande Salle boulevard Saint-Michel 18649
Run Code Online (Sandbox Code Playgroud)
要匹配的单词
[words] => Array
(
[la] => Array
(
[docs] => 26110
[hits] => 29358
)
[comedie] => Array
(
[docs] => …
Run Code Online (Sandbox Code Playgroud) 如果当前日期是 2016-03-06,我想得到这些日期:
2016-03-06
2016-03-05
2016-03-04
2016-03-03
Run Code Online (Sandbox Code Playgroud)
我试图达到这个目的,但我的结果不是我想要的:
$_4date = date("y-m-d",strtotime("day"));
$_3date = date("y-m-d",strtotime("-1 day"));
$_2date = date("y-m-d",strtotime("-2 day"));
$_1date = date("y-m-d",strtotime("-3 day"));
echo $_4date;
echo '<br />';
echo $_3date;
echo '<br />';
echo $_2date;
echo '<br />';
echo $_1date;
Run Code Online (Sandbox Code Playgroud)
结果是:
70-01-01
16-03-05
16-03-04
16-03-03
Run Code Online (Sandbox Code Playgroud)