xunsearch 分面查询结果重复,请看代码

章先生 发布于 2014/07/21 17:29
阅读 398
收藏 0
[goods_id]
type = id

[goods_city]
type=string
index=self
tokenizer = full

[goods_title]
type = title

[goods_discount]
type=numeric

[goods_create_time]
type=numeric

[goods_discount_price]
type=numeric

[goods_init_buy_num]
type=numeric

[goods_is_free_yuyue]
type=string
index=self
tokenizer = full

[goods_is_cash_coupon]
type=string
index=self
tokenizer = full

[goods_activity_id]
type=string
index=self
tokenizer = full

[goods_temp_price]
type=number

[tag_id]
type=string
index=self
tokenizer = full

[b_city]
type=string
index=self
tokenizer = full

[b_districtId]
type=string
index=self
tokenizer = full



[goods_img_path]
type=string

[goods_cost_price]
type=string

[goods_start_time]
type=string

[goods_end_time]
type=string

[goods_give_activity_id]
type=string

[b_around]
type=string


php : 代码
//获取分面统计分类数量
$queryTagFace = 'goods_title:'.$title;
$queryTagFace .= ' AND b_city:'.$cityId.' AND goods_city:'.$cityId;;
$search->setFacets('tag_id',true)->setQuery($queryTagFace)->search();
// echo $search -> query;
$arrTagCount = $search->getFacets('tag_id');
// dump($arrTagCount);

array(12) {
[9005] => int(6)
[9006] => int(6) ------->实际只有3条
[9008] => int(13)

}

tag_id = 9006 的实际只有3条

。。。。
xs 打印:
Xapian::Query((C宠物:(pos=1) AND 0 * M31 AND 0 * B31)) 

但是我加上 折叠搜索 

$search->setCollapse('goods_id')->setFacets('tag_id',true)->setQuery($queryTagFace)->search();

之后 结果就是对的,可是数据没有重复的啊,就算id 标题有重复,但分类不同,这也不算重复啊。。

求帮助!!

加载中
返回顶部
顶部