DDMAL / cantus

:mag: Searching with Optical Music Recognition technology and the Cantus Database
http://cantus.simssa.ca
MIT License
15 stars 3 forks source link

Rewrite SearchNotationView for new OMR search #870

Closed dchiller closed 2 months ago

dchiller commented 3 months ago

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:

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.

dchiller commented 2 months ago

@lucasmarchd01 Could you review?

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

annamorphism commented 2 months ago

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 commented 2 months ago

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?

annamorphism commented 2 months ago

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 commented 2 months ago

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 :shrug:

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".