Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialyzer complains about search_results record. [JIRA: CLIENTS-695] #258

Open
building39 opened this issue Dec 24, 2015 · 0 comments
Open

Comments

@building39
Copy link

riakc.hrl defines search_results like this:

-type search_doc() :: [{binary(), binary()}].
-type search_maxscore() :: float().
-type search_number_found() :: non_neg_integer().

-record(search_results, {
docs :: [search_doc()], %% Result documents
max_score :: float(), %% Maximum score
num_found :: non_neg_integer() %% Number of results
}).

The results record I get back looks like this:

{search_results,
[
{
<<"index_name">>,
[
{
<<"score">>,
<<"3.48490639999999984866e+00">>
},
{
<<"_yz_rb">>,
<<"bucket_type">>
},
{
<<"_yz_rt">>,
<<"bucket_name">>
},
{
<<"_yz_rk">>,
<<"a5680e4664ff480785a50e8324f75384000452410048d33f">>
},
{
<<"_yz_id">>, <<"1_bucket_type_bucket_name_a5680e4664ff480785a50e8324f75384000452410048d33f_30">>
}
]
}
],
3.4849064350128174,
1
}

So, doc is defined as [{binary(), binary()}], but I'm getting back [{binary(), [{binary(), binary()}]}].

Dialyzer complains thusly:

The pattern [{_, Doc}] can never match the type [[{binary(),binary()}]]

where my code looks like:

{ok, Results} = riakc_pb_socket:search(Pid, Index, Query),
[{_, Doc}] = Results#search_results.docs.

Is the record definition wrong, or am I just misunderstanding something?

@Basho-JIRA Basho-JIRA changed the title Dialyzer complains about search_results record. Dialyzer complains about search_results record. [JIRA: CLIENTS-695] Dec 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants