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

Feature/search in listings #37

Merged
merged 2 commits into from
Jul 31, 2020
Merged

Feature/search in listings #37

merged 2 commits into from
Jul 31, 2020

Conversation

krysal
Copy link
Member

@krysal krysal commented Jul 30, 2020

Description

This PR enables the search input of each listing. Initially, search for the user input in these fields:

  • For cases: name, courts, related_cases, background, summary.
  • For scholarships: title, authors, summary

Deployment preview

See https://caselaw-mirr-feature-se-gqlssn.herokuapp.com/
Check for /cases & /scholarship paths.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@krysal krysal requested a review from a team as a code owner July 30, 2020 15:29
@krysal krysal requested review from a team and kgodey and removed request for a team July 30, 2020 15:29
@krysal krysal force-pushed the feature/search-in-listings branch from 8c9d5bc to 45db2e1 Compare July 30, 2020 15:31
@krysal krysal requested a review from TimidRobot July 30, 2020 15:34
Copy link
Member

@kgodey kgodey left a comment

Choose a reason for hiding this comment

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

This looks good, other than the minor comment I made.

I recommend looking into https://github.com/carltongibson/django-filter for more extensible search/filters. You can use a FilterSet to automatically generate filterable models, see https://django-filter.readthedocs.io/en/master/ref/filterset.html

legal_db/views.py Outdated Show resolved Hide resolved
@krysal
Copy link
Member Author

krysal commented Jul 30, 2020

@kgodey I looked to django-filter package and I found it very useful to make detailed filters for models, but for this particular case I think it doesn't quite fit, the way it works creates a form with an individual input field for each filter, but how I pictured this feature was to use a single input field to search on multiple attributes and return the row if a match if found for any of those (OR condition).
This behavior appears to be a work in progress currently: carltongibson/django-filter#1134, carltongibson/django-filter#1167

Although I think it may be useful for the filtering by tags and push filter code on a file apart from views.py, I will review that case and make the correction of the variable name.

@krysal krysal force-pushed the feature/search-in-listings branch from 45db2e1 to 77df346 Compare July 30, 2020 18:12
@kgodey
Copy link
Member

kgodey commented Jul 30, 2020

@krysal that makes sense, I'll approve once you update the variable name.

@krysal
Copy link
Member Author

krysal commented Jul 30, 2020

Done :)

@krysal krysal requested a review from kgodey July 30, 2020 18:15
@krysal krysal merged commit c389cbf into develop Jul 31, 2020
@krysal krysal deleted the feature/search-in-listings branch July 31, 2020 16:41
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