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

feat: sort and search by language/name on edit page #159

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

zhannaklimanova
Copy link
Contributor

@zhannaklimanova zhannaklimanova commented Sep 18, 2024

  • Support sort by language
  • Support sort by name
  • Support search by language

Refs: #137

Sort by Name
image
Sort by Language
image
Search by Language
image

- Support sort by language
- Support sort by name
- Support search by language

Refs: #137
Comment on lines +20 to +25

if search_query:
instrument_names = instrument_names.filter(language__en_label__icontains=search_query)

instrument_names = instrument_names.order_by(sort_by)
context["instrument_names"] = instrument_names
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a solr set-up for UMIL... let's use that for search!

Lemme know if you want some examples for how to set this up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, some example would be great!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, a few things would be helpful:

  • The solr admin panel is location at port 8983 (so in development at localhost:8983). One of the more useful areas of this for debugging search applications is the Query section. In the drop-down on the left, you'll see the virtual-instrument-museum core. Select that one, and then in the panel that appears you can go to Query to get a UI for making solr queries. Useful for debugging queries.
  • An example from Cantus Ultimus: we use this view to query solr to provide search suggestions: https://github.com/DDMAL/cantus/blob/main/app/public/cantusdata/views/suggestion.py. The view is pretty simple: building a request to the solr server and then making it with the requests package.
  • I don't have an example of this, but if you wanted to perform the search without routing through a Django view, you could just make the request via Javascript to the solr server (eg. have the browser request to an endpoint that your route to the solr server using the nginx configurations and then unpack the json response in the client).

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.

2 participants