-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
- Adjust select solr config with json transformer - Rename "location" field to "location_json" - Update MEI parsing and tokenizing for above
2856bba
to
2d814d1
Compare
@lucasmarchd01 Could you review? @lucasmarchd01 @annamorphism Do you have thoughts about the name of the pitch search? |
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...) |
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?
|
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. |
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": |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this 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!
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. Thetext
andincipit
searches were removed because they are handled by the normal search view. Theinterval
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, whilePitch (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 ofpitch_names
type do not search transpositions, while queries of typepitch_names_transposed
do search transpositions.The rewrite of the
SearchNotationView
necessitated the change of some functions insearch_utils.py
:validate_query
, that tests whether or not a query string for a particular type of OMR search (neume names, pitches, etc.) is validtranspose_up_unicode
, which was renamed fromtransposeUp
and uses the unicode for note names to transpose a note up one stepget_transpositions
, which gets all diatonic transpositions of a given sequence of note namesTests for these functions were added.
This PR introduces the use of the
json
transformer on thelocation
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 thelocation
field tolocation_json
.Closes #874.