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

Exception when no ranking field is provided #7

Open
mateuszmrozewski opened this issue Jan 12, 2012 · 0 comments
Open

Exception when no ranking field is provided #7

mateuszmrozewski opened this issue Jan 12, 2012 · 0 comments

Comments

@mateuszmrozewski
Copy link

    if rank_descending:
        sorted_ranked_query_result_set = sorted(dedup_query_result_list, 
                                                key=lambda result: (result.__partial_match_search__primary_rank,
                                                getattr(result, ranking_field)), reverse=True)
    else:
        sorted_ranked_query_result_set = sorted(dedup_query_result_list, 
                                                key=lambda result: (-result.__partial_match_search__primary_rank,
                                                getattr(result, ranking_field)))

This part of code raises execption on getattr() when no ranking_field is provided. Considering the doc and function arguments this should be a valid usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant