-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add search queries #23
Comments
see : https://musicbrainz.org/doc/MusicBrainz_API/Search
|
I've been fiddling with search queries, and trying to figure out how search queries on other entities maybe implemented. I tried to implement searches based on the This |
I think adding more optional will be confusing for the end user. It would be simpler to use an associated type to the pub trait Search<'a> {
type SearchResult;
fn search(query: String) -> SearchQuery<Self::SearchResult>
// .... This way we could define a custom struct to hold the search result or reuse an existing one when possible. |
Which entity should I query if I want to auto-tag midi files based on artist and song title extracted from a midi filename? (Actually, the extraction is not trivial because the artist and song name can be in any order, with spelling mistakes, sometimes separated by |
This could be complex depending on how much you know about what is in your midi filename. Let say you are trying to auto-tag "IAM - Demain c'est loin.midi" I would probably start with something like this :
This would translate into musicbrainz_rs (not implemented yet for recording) : let query = Recording::query_builder()
.artist("Iam")
.and()
.title("Demain c'est loin")
.or()
.title(Iam")
.and()
.artist("Demain c'est loin")
.build();
let result = Artist::search(query).execute(); Also we currently don't expose the search score but this could be be useful for use cases like yours. @ritiek do you think we could expose search score ? |
@Boscop I think fuzzy search capabilities could be somewhat useful too if you suspect spelling mistakes in filenames.
The API search response does expose a |
@ritiek Does musicbrainz support fuzzy search, too? |
Yep, musicbrainz API does support it. Although I'm not sure how effective it would be for your use-case but it might be worth a try. |
Does this crate pass it through? So could I use it for any entity lookup with this crate? |
Yes, this crate will pass the fuzzy operator use musicbrainz_rs::entity::artist::Artist;
use musicbrainz_rs::prelude::*;
fn main() {
let query = String::from("query=artist:kayden~");
let query_result = Artist::search(query).execute().unwrap();
println!("{:?}", query_result);
} @oknozor I'm also curious on whether While it works as expected when using the |
I just checked you are correct. It was working previously with "name" because lucene seems to search on any field when the input field is unknown, unless you use fuzzy search. We can fix this by adding |
Musicbrainz officially uses the "artist" field to search for artists, and this has been giving incorrect results when trying to fuzzy search through the "name" field. See RustyNova016#23 for more details.
Musicbrainz officially uses the "artist" field to search for artists, and this has been giving incorrect results when trying to fuzzy search through the "name" field. See #23 for more details.
Musicbrainz officially uses the "artist" field to search for artists, and this has been giving incorrect results when trying to fuzzy search through the "name" field. See #23 for more details.
No description provided.
The text was updated successfully, but these errors were encountered: