Closed mogadanez closed 9 years ago
but it works de-facto 25.06.2015 19:09 пользователь "bkerley" notifications@github.com написал:
Yokozuna/Riak Search doesn't support facets and grouping. We use Solr for the initial search, but Yokozuna aggregates search results from multiple sources into a single response, and doesn't implement faceting and grouping.
— Reply to this email directly or view it on GitHub https://github.com/basho/riak-nodejs-client/issues/73#issuecomment-115305954 .
Tested right now.
export RIAK_HOST="http://localhost:8098"
curl -XPUT $RIAK_HOST/search/index/famous
riak-admin bucket-type create animals '{"props":{}}'
riak-admin bucket-type activate animals
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/liono \
-H 'Content-Type: application/json' \
-d '{"name_s":"Lion-o", "age_i":30, "leader_b":true}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/cheetara \
-H 'Content-Type: application/json' \
-d '{"name_s":"Cheetara", "age_i":28, "leader_b":false}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/snarf \
-H 'Content-Type: application/json' \
-d '{"name_s":"Snarf", "age_i":43}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/panthro \
-H 'Content-Type: application/json' \
-d '{"name_s":"Panthro", "age_i":36}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/liono1 \
-H 'Content-Type: application/json' \
-d '{"name_s":"Lion-o1", "age_i":30, "leader_b":true}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/cheetara1 \
-H 'Content-Type: application/json' \
-d '{"name_s":"Cheetara1", "age_i":30, "leader_b":false}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/snarf1 \
-H 'Content-Type: application/json' \
-d '{"name_s":"Snarf1", "age_i":43}'
curl -XPUT $RIAK_HOST/types/animals/buckets/cats/keys/panthro1 \
-H 'Content-Type: application/json' \
-d '{"name_s":"Panthro1", "age_i":28}'
compare queries via internal_solr and pony and yokozuna front-end: riak1/internalsolr/famous/select?q=:_&rows=0&indent=true&facet=true&facet.field=age_i
...
<lst name="age_i">
<int name="30">3</int>
<int name="28">2</int>
<int name="36">1</int>
<int name="43">1</int>
</lst>
...
riak2/internalsolr/famous/select?q=:_&rows=0&indent=true&facet=true&facet.field=age_i
<lst name="age_i">
<int name="30">3</int>
<int name="43">2</int>
<int name="28">1</int>
<int name="36">1</int>
</lst>
riak3/internalsolr/famous/select?q=:_&rows=0&indent=true&facet=true&facet.field=age_i
<lst name="age_i">
<int name="28">2</int>
<int name="43">2</int>
<int name="30">1</int>
</lst>
riak4/internalsolr/famous/select?q=:_&rows=0&indent=true&facet=true&facet.field=age_i
<lst name="age_i">
<int name="28">1</int>
<int name="43">1</int>
</lst>
riak5/internalsolr/famous/select?q=:_&rows=0&indent=true&facet=true&facet.field=age_i
<lst name="age_i">
<int name="30">2</int>
<int name="36">1</int>
</lst>
This confirm your point that it is different data on different nodes
then try to test on youkozuna endpoint: [riak1|riak2|riak3|riak4|riak5]search/query/famous?q=:&fl=name_s&rows=0&facet=true&facet.field=age_i
all of them returns same result: (full result)
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">107</int>
<lst name="params">
<str name="10.0.0.24:48093">_yz_pn:59 OR _yz_pn:44 OR _yz_pn:29 OR _yz_pn:14</str>
<str name="facet">true</str>
<str name="shards">
10.0.0.24:18093/internal_solr/famous,10.0.0.24:28093/internal_solr/famous,10.0.0.24:38093/internal_solr/famous,10.0.0.24:48093/internal_solr/famous,10.0.0.24:58093/internal_solr/famous
</str>
<str name="fl">name_s</str>
<str name="q">*:*</str>
<str name="10.0.0.24:58093">
(_yz_pn:60 AND (_yz_fpn:60)) OR _yz_pn:50 OR _yz_pn:35 OR _yz_pn:20 OR _yz_pn:5
</str>
<str name="10.0.0.24:18093">_yz_pn:56 OR _yz_pn:41 OR _yz_pn:26 OR _yz_pn:11</str>
<str name="10.0.0.24:28093">_yz_pn:47 OR _yz_pn:32 OR _yz_pn:17 OR _yz_pn:2</str>
<str name="facet.field">age_i</str>
<str name="10.0.0.24:38093">
_yz_pn:63 OR _yz_pn:53 OR _yz_pn:38 OR _yz_pn:23 OR _yz_pn:8
</str>
<str name="rows">0</str>
</lst>
</lst>
<result name="response" numFound="8" start="0" maxScore="1.0"/>
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="age_i">
<int name="30">3</int>
<int name="28">2</int>
<int name="43">2</int>
<int name="36">1</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>
</response>
so it is collect and join facet data from all nodes
@mogadanez thank you for the detailed test.
Currently, the inability to perform facet searches is a limitation in Riak. I will investigate to see if there is a plan to add this to Riak.
in sample above I show that its works fine via http interface.
Correct, but the Node.js and other Riak clients use Riak's protocol buffers interface, which does not support facet parameters. I'll post an update when I learn more.
found related issue https://github.com/basho/riak_pb/issues/72
@mogadanez - I have forwarded your request onto product management. Facet query support via protocol buffers is under investigation for inclusion in a future Riak release.
At this time, querying Riak via HTTP (as you have shown) is the current way to do facet queries.
Thanks.
we are use at least: