...->setQuery(); $search = $xs->search; $search->query = ''; $count = $search->addRange('price',600,1000)->count(); $search->addRange('price',600,1000)->search(); $count2 = $search->getLastCount(); echo $xs->search->getDbTotal().''; echo $count.' count2:'.$count2; ...
如果getLastCount和count都放在search的后面,那么他们两获取的结果是一样的, 如果getLastCount放在search的前面,count放在后面,这样LastCount是获取上次一search的结果数量,count是本次的数量
具体看说明书吧。 count() 可以传入搜索关键词执行搜索再统计 getLastCount() 必须依赖于最近的一次 search()
...的条件addRange 5、搜索前统计数量用于分页$total = $search->count(); 6、设置分页$search->setLimit(xxx,xxx); 7、取得结果$docs = $search->search(); 这样的一般过程吧,但第5步出来的数量貌似不准确啊 然后改成这样 1、实例化得到$xs = new Xs...
标题的结果 $count = $limit + $offset 搜索内容为: tags:公务员考试 AND tags:论文 AND tags:杂志 AND tags:报纸 AND tags:教材 这时就会出现问题 如果是:tags:公务员考试 AND tags:论文 AND tags:杂志 AND tags:报纸 AND tags:教材 AND 图书 结果就是...
function get_tfidf($word, $count) { if ($count < 1000) $count = 21000 - $count * 18; $tf = log($count); $tf = pow($tf, 5) * log(strlen($word)); $tf = log($tf); $idf = log(5000000000/$count); //if ($tf > 13) $idf *= 1.4; return array($...
function get_tfidf($word, $count) { if ($count < 1000) $count = 21000 - $count * 18; $tf = log($count); $tf = pow($tf, 5) * log(strlen($word)); $tf = log($tf); $idf = log(5000000000/$count); //if ($tf > 13) $idf *= 1.4; return array($...