Anonymous avatar Anonymous committed fe0d71b

Filter node annotations

Commit d3ccf9 in riak_core added annotations to the preflist which
vnode_master command doesn't take account for. For now the clients
will just have to filter out the annotations themselves but we should
look at making the preflist an opaque type to avoid stuff like this in
the future.

Comments (0)

Files changed (1)

apps/riak_search/src/riak_search_op_term.erl

     DocIdx = riak_search_ring_utils:calc_partition(Index, Field, Term),
     {ok, Schema} = riak_search_config:get_schema(Index),
     NVal = Schema:n_val(),
-    Preflist = riak_core_apl:get_primary_apl(DocIdx, NVal, riak_search),
+    Preflist = get_preflist(DocIdx, NVal),
 
     %% Try to use the local node if possible. Otherwise choose
     %% randomly.
     DocIdx = riak_search_ring_utils:calc_partition(Index, Field, Term),
     {ok, Schema} = riak_search_config:get_schema(Index),
     NVal = Schema:n_val(),
-    Preflist = riak_core_apl:get_primary_apl(DocIdx, NVal, riak_search),
+    Preflist = get_preflist(DocIdx, NVal),
     
     {ok, Ref} = riak_search_vnode:info(Preflist, Index, Field, Term, self()),
     {ok, Results} = riak_search_backend:collect_info_response(length(Preflist), Ref, []),
                         [Score]
                 end,
     lists:keystore(score, 1, Props, {score, ScoreList}).
+
+get_preflist(DocIdx, NVal) ->
+    [{Idx,Node}
+     || {{Idx,Node},primary} <- riak_core_apl:get_primary_apl(DocIdx,
+                                                              NVal,
+                                                              riak_search)].
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.