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

Fix search ordered by best match #3706

Merged
merged 5 commits into from
Apr 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions redash/handlers/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get(self):
# order results according to passed order parameter,
# special-casing search queries where the database
# provides an order by search rank
ordered_results = order_results(results, fallback=bool(search_term))
ordered_results = order_results(results, fallback=not bool(search_term))

page = request.args.get('page', 1, type=int)
page_size = request.args.get('page_size', 25, type=int)
Expand Down Expand Up @@ -334,7 +334,7 @@ def get(self):
# order results according to passed order parameter,
# special-casing search queries where the database
# provides an order by search rank
favorites = order_results(favorites, fallback=bool(search_term))
favorites = order_results(favorites, fallback=not bool(search_term))

page = request.args.get('page', 1, type=int)
page_size = request.args.get('page_size', 25, type=int)
Expand Down
6 changes: 3 additions & 3 deletions redash/handlers/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def get(self):
# order results according to passed order parameter,
# special-casing search queries where the database
# provides an order by search rank
ordered_results = order_results(results, fallback=bool(search_term))
ordered_results = order_results(results, fallback=not bool(search_term))

page = request.args.get('page', 1, type=int)
page_size = request.args.get('page_size', 25, type=int)
Expand Down Expand Up @@ -290,7 +290,7 @@ def get(self):
# order results according to passed order parameter,
# special-casing search queries where the database
# provides an order by search rank
ordered_results = order_results(results, fallback=bool(search_term))
ordered_results = order_results(results, fallback=not bool(search_term))

page = request.args.get('page', 1, type=int)
page_size = request.args.get('page_size', 25, type=int)
Expand Down Expand Up @@ -464,7 +464,7 @@ def get(self):
# order results according to passed order parameter,
# special-casing search queries where the database
# provides an order by search rank
ordered_favorites = order_results(favorites, fallback=bool(search_term))
ordered_favorites = order_results(favorites, fallback=not bool(search_term))

page = request.args.get('page', 1, type=int)
page_size = request.args.get('page_size', 25, type=int)
Expand Down
2 changes: 1 addition & 1 deletion redash/handlers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_users(self, disabled, pending, search_term):
# order results according to passed order parameter,
# special-casing search queries where the database
# provides an order by search rank
return order_results(users, fallback=bool(search_term))
return order_results(users, fallback=not bool(search_term))

@require_permission('list_users')
def get(self):
Expand Down
1 change: 0 additions & 1 deletion redash/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ def all_queries(cls, group_ids, user_id=None, include_drafts=False, include_arch
contains_eager(Query.user),
contains_eager(Query.latest_query_data),
)
.order_by(Query.created_at.desc())
)

if not include_drafts:
Expand Down