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

Rewrite SearchNotationView for new OMR search #870

Merged
merged 6 commits into from
Jun 12, 2024

Conversation

dchiller
Copy link
Collaborator

@dchiller dchiller commented May 27, 2024

The SearchNotation view was refactored and reorganized for clarity and to include type annotations and a variety of checks on the passed parameters. Searches for neume names, both transposed and fixed pitches, and contour are supported. The text and incipit searches were removed because they are handled by the normal search view. The interval search was removed for now because it has not yet been implemented in the MEI parsing and indexing. An issue to add it back has been created (#875).

One odd thing is that on the old version of OMR search, Pitch search did not search transpositions of pitches, while Pitch (Invariant) search did. See images. To me, that seems the wrong way around. I've kept this labeling that way in this PR, but I'm curious for @lucasmarchd01 and @annamorphism's opinion. UPDATE: The relevant places in this PR have been updated to that queries of pitch_names type do not search transpositions, while queries of type pitch_names_transposed do search transpositions.
image

image

The rewrite of the SearchNotationView necessitated the change of some functions in search_utils.py:

  • a new function, validate_query, that tests whether or not a query string for a particular type of OMR search (neume names, pitches, etc.) is valid
  • a renamed function, transpose_up_unicode, which was renamed from transposeUp and uses the unicode for note names to transpose a note up one step
  • get_transpositions, which gets all diatonic transpositions of a given sequence of note names
    Tests for these functions were added.

This PR introduces the use of the json transformer on the location field in solr. With this change, the solr server returns a json object in the location field (when parsed in python, this is then a dictionary), rather than a string of json that must then be separately parsed in python or javascript. This feature is added by modifying the solr config file and (for clarity) changing the name of the location field to location_json.

Closes #874.

- Adjust select solr config with json transformer
- Rename "location" field to "location_json"
- Update MEI parsing and tokenizing for above
@dchiller
Copy link
Collaborator Author

@lucasmarchd01 Could you review?

@lucasmarchd01 @annamorphism Do you have thoughts about the name of the pitch search?

@annamorphism
Copy link

I agree that pitch(invariant) should give only cdecd results in this case. (as an aside, why are all the contours different shapes?) I think there must be a better way to signal that the "Pitch" search includes transpositions, though. (In CantusDB's melody search they are, respectively, "Exact match" and "Exact match+transpositions," which is maybe a little wordy for the dropdown, but clear...)

@lucasmarchd01
Copy link

Yeah, I guess the word "invariant" probably isn't the best choice because it can mean two different things in this context.

What about one of these?

  • Pitch search -> "Pitch (exact) search" or "Pitch (fixed) search"
  • Pitch (invariant) search -> "Pitch (pattern) search" or "Pitch (transposition-invariant) search" or "Pitch (flexible) search"

@annamorphism
Copy link

Yes, something like Pitch (exact) and Pitch (pattern) could work. I like "flexible" too, but wonder if it suggests that you'd get some sort of fuzzy match and not an exact match for a transposition.

@dchiller
Copy link
Collaborator Author

as an aside, why are all the contours different shapes?

It's a good question. These images are from the way-old archive site, so I don't really know (I do know that this is using old and very incorrect MEI). They are correct as far as I can tell with the new files so 🤷

I like "Pitch (exact)"... and maybe either "Pitch (pattern)" or "Pitch (transposed)"

Note that there is also an "Interval" search so you could just search for a perfect 5th and get all transpositions of "c - g" except for "b - f".

match q_type:
case "neume_names":
return all(neume in VALID_NEUME_NAME_WORDS for neume in q)
case "pitch_names" | "pitch_names_invariant":

Choose a reason for hiding this comment

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

I guess I can wait to approve this until we decide what to rename the pitch searches?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I made changed this so that for the backend we have pitch_names and pitch_names_transposed...we can make the user-facing designation slightly different, but I think that this is probably the simplest for development?

Copy link

@lucasmarchd01 lucasmarchd01 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@dchiller dchiller merged commit 9c3f417 into DDMAL:main Jun 12, 2024
2 checks passed
@dchiller dchiller deleted the add-search-notation-view branch June 12, 2024 13:51
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.

Modify notation search view for updated OMR search
3 participants