feat: raise search results limit from 30 to 150
30 results was too low once pc-builder.io's full catalog is scraped (e.g. 47 RTX 5070/5070 Ti variants alone), silently truncating results a user would otherwise see. Also added a result count hint in NewPartSearch.vue since the list is scrollable (max-h-96) rather than paginated, so it wasn't obvious more results existed below the fold.
This commit is contained in:
1 parent
6053290501
commit
a1f6ff419a
2 files changed
+7
-2
No files matched your search
@@ -5,6 +5,8 @@ import ComponentType from '#models/component_type'
|
||||
import { ensureFreshCategory, updatePriceIfCheaper } from '#services/part_scraper_service'
|
||||
import { findCheapestOffers } from '#services/merchant_price_service'
|
||||
|
||||
const SEARCH_RESULTS_LIMIT = 150
|
||||
|
||||
const searchValidator = vine.compile(
|
||||
vine.object({
|
||||
q: vine.string().trim().minLength(1).optional(),
|
||||
@@ -59,7 +61,7 @@ export default class ScrapedPartsController {
|
||||
query.where('typeId', typeId)
|
||||
}
|
||||
|
||||
const parts = await query.limit(30)
|
||||
const parts = await query.limit(SEARCH_RESULTS_LIMIT)
|
||||
return response.json(parts.map((part) => part.serialize()))
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,11 @@ function importPart(part: ScrapedPart) {
|
||||
<p v-else-if="hasSearched && results.length === 0" class="text-sm text-gray-500 mt-2">
|
||||
No matching part found.
|
||||
</p>
|
||||
<p v-else-if="results.length > 0" class="text-xs text-gray-500 mt-2">
|
||||
{{ results.length }} result{{ results.length > 1 ? 's' : '' }} — scroll for more
|
||||
</p>
|
||||
|
||||
<ul v-if="results.length > 0" class="mt-3 space-y-2 max-h-96 overflow-y-auto">
|
||||
<ul v-if="results.length > 0" class="mt-1 space-y-2 max-h-96 overflow-y-auto">
|
||||
<li
|
||||
v-for="part in results"
|
||||
:key="part.id"
|
||||
|
||||
Reference in new issue
Block a user