![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
Caliber metadata plugin ignors source_relevance attribute
adding multiple books into the result_queue with different source_relevance has no effect on the UI displaying the book search results,
i have tried adding the levenshtein_distance result, (i actually use: fuzzywuzzy.QRatio) and in the example of 4 books the results entered into the source_relevance attributes are: 61, 58, 58, 58 i also tried converting them into sequential order: 1, 2, 3, 4 and it still has no effect on the UI. i made sure the experience is the same for hebrew and english Caliber interface languages, i searched the forum (there are only 2 mentions with source_relevance, non related to this issue), i searched the source code and it looks like there is a preparation for ordering logic, but i can't find any code actually implementing it https://github.com/kovidgoyal/calibr...es/base.py#L94 (maybe this is it ?) it is not an important feature when i return multiple options (no one perfect match) and i want the user to choose from, but it is an important feature when the user execute 10, 20, 50 ... books to get metadata and multiple books are returned - and Caliber should auto-select the first (with the highest source_relevance) if anyone knows of a better option (like Caliber somehow signal the plugin this is a batch call and to return only 1 book, or better yet - to return multiple results for all the searched books) thanks ahead |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,262
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It most definitely is used look in sources/identify.py
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
i have checked this testcase multiple times with no avail, but i will look into the code and update here
10x |
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
so apparently the source_relevance is not the only attribute the compare takes into consideration when sorting the book results by relevance, but also the comments length, if it has a cover, are the identifier of searched book and current results resembles etc.
i could not find that in the docs, only in the code comments, i think it is an important part to mention, so i will quote it here for others: function identify_results_keygen returns a function that will generate a key that the sort will use as a sorting key: PHP Code:
Code:
Returns a function that is used to generate a key that can sort Metadata objects by their relevance given a search query (title, authors, identifiers). These keys are used to sort the results of a call to :meth:`identify`. For details on the default algorithm see :class:`InternalMetadataCompareKeyGen`. Re-implement this function in your plugin if the default algorithm is not suitable. Code:
Generate a sort key for comparison of the relevance of Metadata objects, given a search query. This is used only to compare results from the same metadata source, not across different sources. The sort key ensures that an ascending order sort is a sort by order of decreasing relevance. The algorithm is: * Prefer results that have at least one identifier the same as for the query * Prefer results with a cached cover URL * Prefer results with all available fields filled in * Prefer results with the same language as the current user interface language * Prefer results that are an exact title match to the query * Prefer results with longer comments (greater than 10% longer) * Use the relevance of the result as reported by the metadata source's search engine for me it was the length of the comments that overcame the relevance, basically the source_relevance (.extra) is taken into consideration if and only if all else is the same PHP Code:
PHP Code:
|
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
it is also mentioned in the plugin docs, just digg:
https://manual.calibre-ebook.com/plugins.html |
![]() |
![]() |
Advert | |
|
![]() |
Tags |
metabata, plugin, source_relevance |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I know which Metadata Source Plugin was called from fetch-ebook-metadata? | eryMpexI | Library Management | 6 | 04-22-2023 08:58 AM |
[Metadata Source Plugin] Empty Plugin? (Fake Identifier) | mneimeyer | Plugins | 3 | 11-11-2019 08:07 PM |
Can't download metadata in Caliber | mneumayer | Calibre | 1 | 09-10-2018 08:45 PM |
Regarding using metadata objects in identify method of metadata download plugin api | aprekates | Development | 1 | 07-06-2014 03:35 AM |
How does Caliber store MetaData? | JGB | Calibre | 4 | 12-10-2008 12:53 AM |