Repository navigation
fix(images): identify image results by the image, not its page - #3313
Closed
noahkhomer18 wants to merge 1 commit into
Closed
noahkhomer18 wants to merge 1 commit into
noahkhomer18 wants to merge 1 commit into
Conversation
Image results were deduplicated, reranked, merged into history and keyed on screen by their page URL, so several images from one gallery page collapsed into the first. Identify an image by its full-size source, then its thumbnail, then its page, through one shared helper, everywhere those steps happen. Text results still deduplicate by URL.
Three existing refreshImageSearchResults tests gave every row the same placeholder image ("thumb", "source"), which under the new identity made different pages one image; they now give each row its own image.
Fixes felladrin#3294
Signed-off-by: Noah Khomer <108771853+noahkhomer18@users.noreply.github.com>
Owner
|
@noahkhomer18 Thanks a lot for this, and sorry for the wasted effort! #3312 fixed the same issue a few minutes earlier, and it's now merged (ee2a4bf), so I'm closing this one as a duplicate. Your single shared |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3294.
Image results were identified by their page URL in every step that compares them, so several images from one gallery page collapsed into the first. They are now identified by the image itself:
getImageIdentityinshared/imageIdentity.tsreturns the full-size source, then the thumbnail, then the page URL. Text results still deduplicate by URL.Where the identity is now used:
openableUniqueResultsdeduplicates image searches by identity (text searches are unchanged), and the image branch ofsearchEndpointServerHookranks by identity and maps each ranked entry back to its own row, so two images on one page no longer both resolve to the first.refreshImageSearchResultsandstartImageSearchmerge new images into the ones on screen through one helper,imagesNotIninclient/modules/imageResults.ts.mergeSearchImageResultsinhistory.tsmerges stored images the same way.ImageResultsListkeys tiles, thumbnail sources and failed-thumbnail state by identity.One existing test changed
Three
refreshImageSearchResultstests gave every row the same placeholder image ("thumb","source"). Under the new identity that made rows from different pages the same image, so they would collapse. Each row now has its own image (https://<host>/thumb.jpg,https://<host>/full.jpg). What the tests assert is unchanged.How to test
New tests, one per place the identity is used: deduplication in
webSearchService, reranking insearchEndpointServerHook, merging on screen inchatHelpersandtextGeneration, merging into history inhistory, and tile keys inImageResultsList. With the six source files put back tomain, all six fail (6 failed, 224 passed in those files). With this branch they pass.To see it in the app:
url(https://example.com/gallery) and differentimg_src.Not tested: against a live SearXNG instance. The rows above come from the unit tests' stubs.