带狮身人面像的智能过滤器
Smart filter with sphinx
如何为网上商店建立正确的过滤器。
例如:
我们有手机 phone,名称(IPhone、小米等)和参数(内存、电池容量)。
问题:
我有 5 个内存选项(1gb、2gb、3gb、4gb、5gb)。当我 select 任何内存选项时,其他过滤器必须使用新计数重建,但内存过滤器不得更改。如果我使用狮身人面像作为
select * from phones where memory='1gb' facet memory facet name
我看到结果只有 1gb 的内存,这不好,因为我必须 select phone 1gb 和 2gb。
唉,sphinx 不能直接做到这一点,FACET
函数没那么聪明。
只需按查询 'manually' 编组即可。
select * from phones where match('keyword') and memory='1gb';
select memory,count(*) from phones where match('keyword') group by memory;
select name,count(*) from phones where match('keyword') and memory='1gb' group by name;
... 即只是 显式地从内存组中省略 内存过滤器。这就是 FACET
所做的一切,自动创建这些额外的 GROUP BY 查询。
如何为网上商店建立正确的过滤器。
例如: 我们有手机 phone,名称(IPhone、小米等)和参数(内存、电池容量)。
问题:
我有 5 个内存选项(1gb、2gb、3gb、4gb、5gb)。当我 select 任何内存选项时,其他过滤器必须使用新计数重建,但内存过滤器不得更改。如果我使用狮身人面像作为
select * from phones where memory='1gb' facet memory facet name
我看到结果只有 1gb 的内存,这不好,因为我必须 select phone 1gb 和 2gb。
唉,sphinx 不能直接做到这一点,FACET
函数没那么聪明。
只需按查询 'manually' 编组即可。
select * from phones where match('keyword') and memory='1gb';
select memory,count(*) from phones where match('keyword') group by memory;
select name,count(*) from phones where match('keyword') and memory='1gb' group by name;
... 即只是 显式地从内存组中省略 内存过滤器。这就是 FACET
所做的一切,自动创建这些额外的 GROUP BY 查询。