Skip to content

Instantly share code, notes, and snippets.

@wardbekker
Created September 9, 2011 09:43
Show Gist options
  • Save wardbekker/1205850 to your computer and use it in GitHub Desktop.
Save wardbekker/1205850 to your computer and use it in GitHub Desktop.
handle_cast({ get_results, Terms, FacetCategories, Mod, Fun, Ref }, State) ->
TermResults = keyword_ser:do_query(Terms),
{DocumentIds, Scores} = lists:unzip(TermResults),
Documents = gen_server:call(document_ser, {get_documents, DocumentIds}),
erlang:apply( Mod, Fun, [{docs, lists:zip(Scores, Documents) }, Ref]),
FacetResults = lists:map(
fun(Category) ->
{ Category, facet_ser:get_facets(Category, DocumentIds)}
end,
FacetCategories
),
erlang:apply( Mod, Fun, [{facet_results, FacetResults}, Ref]),
{noreply, State};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment