Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Allow pgsql filter threshold to be configured. #85

Merged
merged 2 commits into from Aug 21, 2017

Conversation

cmc333333
Copy link
Member

This threshold depends on the documents we're searching. It'd be helpful to
allow an agency implementation to show all matches, for example.

This threshold depends on the documents we're searching. It'd be helpful to
allow an agency implementation to show all matches, for example.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 93.703% when pulling 0b2166f on 475-config-search-limit into 618955d on master.

@@ -11,7 +12,7 @@ def matching_sections(search_args):
sections_query = Document.objects\
.annotate(rank=SearchRank(
F('documentindex__search_vector'), SearchQuery(search_args.q)))\
.filter(rank__gte=0.15)\
.filter(rank__gt=settings.PG_SEARCH_RANK_CUTOFF)\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to change from >= to >?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I should have added that to the commit. The use case I was thinking of was returning all matches, regardless of particular ranking. Non-matches will have a rank of zero, so to achieve this goal we want to say match anything strictly greater than zero. We could simulate it with >= via 0.0000001 or what have you, but I figured this was a little cleaner.

@cmc333333
Copy link
Member Author

Thanks @tadhg-ohiggins . I'll bump the version number then merge.

New features
* #85 Ability to configure the search result match threshold in pgsql
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 93.703% when pulling 228d8f6 on 475-config-search-limit into 618955d on master.

@cmc333333 cmc333333 merged commit d544333 into master Aug 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants