mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
edit searchPopular comment
This commit is contained in:
+12
-8
@@ -108,19 +108,23 @@ func fetchResultsForSuffix(ctx context.Context, auditor *audit.Auditor, r *http.
|
||||
return nil
|
||||
}
|
||||
|
||||
// searchPopular performs a search for popular artworks.
|
||||
// searchPopular performs a search for popular artworks using a descending popularity threshold strategy.
|
||||
//
|
||||
// The search strategy is as follows:
|
||||
//
|
||||
// 1. First checks the highest popularity threshold (100000 users)
|
||||
// 1. Starts by checking the highest popularity threshold (100000 users).
|
||||
// - If results are found at the highest threshold, it stores these results.
|
||||
// - Continues checking lower thresholds in descending order (e.g., 50000, 30000, etc.),
|
||||
// adding results until the resultsLimit is reached.
|
||||
//
|
||||
// 2. If results are found at highest threshold:
|
||||
// - Continues checking lower thresholds in descending order until resultsLimit is reached
|
||||
// 2. If no results are found at the highest threshold:
|
||||
// - Temporarily stores results from the lowest threshold (50 users).
|
||||
// - Then, checks all intermediate thresholds (50000 down to 100 users).
|
||||
// - Uses the temporarily stored lowest threshold results only if the resultsLimit
|
||||
// cannot be reached with results from higher thresholds.
|
||||
//
|
||||
// 3. If no results at highest threshold:
|
||||
// - Temporarily stores results from lowest threshold (50 users)
|
||||
// - Checks all intermediate thresholds (50000 down to 100 users)
|
||||
// - Only uses lowest threshold results if resultsLimit cannot be reached with higher thresholds
|
||||
// 3. Assembles the final list of results in descending order of popularity thresholds,
|
||||
// stopping when the total number of results reaches resultsLimit.
|
||||
func searchPopular(ctx context.Context, auditor *audit.Auditor, r *http.Request, settings SearchPageSettings, headers http.Header) (SearchArtworks, error) {
|
||||
auditor.SugaredLogger.Debugw("Starting popular search", "query", settings.Name, "mode", settings.Category)
|
||||
suffixes := []string{"100000", "50000", "30000", "10000", "5000", "1000", "500", "100", "50"}
|
||||
|
||||
Reference in New Issue
Block a user