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

issue/28 - Text search for events #108

Merged
merged 3 commits into from
Dec 13, 2019
Merged

issue/28 - Text search for events #108

merged 3 commits into from
Dec 13, 2019

Conversation

shawnvarghese
Copy link
Collaborator

@shawnvarghese shawnvarghese commented Dec 2, 2019

Added search capability to the webpage

@shawnvarghese shawnvarghese changed the title issue/28 - Full text search for events issue/28 - Text search for events Dec 2, 2019
start_time=start_time,
end_time=end_time,
)
class HomepageView(View):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I refactored this view a little bit so that it is more consistent to the way the other views are coded.

query = query & Q(start_datetime__range=(current_timezone.localize(start_date),
current_timezone.localize(end_date)))
if search:
query = query & (Q(title__icontains=search) | Q(description__icontains=search))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As per the docs, it seems that we need to be using PostgreSQL DB before being able to use Django's full text search (https://docs.djangoproject.com/en/2.2/ref/contrib/postgres/search/)
So I thought I'll update this later when we migrate to Postgres. Currently, the search only matches title and description, but we would have to add more fields like location soon (#103)

</div>
<div class="grid-col-4">

<div class="grid-col-4 desktop:display-block mobile: display-none">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As the calendar causes issues on mobile screens, I have disabled the datepicker for mobile for now. Should we have a different style of datepicker for mobile ui? Or maybe a button to toggle the calendar view on/off?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can just use a regular date select for mobile.

Copy link
Collaborator

@mikeubell mikeubell left a comment

Choose a reason for hiding this comment

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

In trying this out, after searching, then moving to next month and then back to the same month the search term seems to still be in force. This is not intuitive.

@@ -114,7 +114,7 @@
"pk": 6,
"fields": {
"title": "Approved CodeForSanJose Hack Night",
"description": "This is an event that is pending",
"description": "This is an event that is approved",
"recurrences": "RRULE:FREQ=WEEKLY;BYDAY=TU",
"start_datetime": "2019-10-12T18:30:00-0700",
"end_datetime": "2019-10-12T21:00:00-0700",
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do these changes have to do with Text Search?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They dont; I was just correcting the description to keep it consistent with the title of the event.

@shawnvarghese
Copy link
Collaborator Author

In trying this out, after searching, then moving to next month and then back to the same month the search term seems to still be in force. This is not intuitive.

I agree, I wasn't convinced of this either. But I had a look at meetup.com and it does something similar this. Would it be more intuitive if we persisted the search term in the search bar as we scrolled between months?

Copy link
Collaborator

@mikeubell mikeubell left a comment

Choose a reason for hiding this comment

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

Ok to merge

@shawnvarghese shawnvarghese merged commit 4fca152 into master Dec 13, 2019
@shawnvarghese shawnvarghese deleted the issue/28 branch December 13, 2019 08:19
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

Successfully merging this pull request may close these issues.

3 participants