files search added (wip)
This commit is contained in:
parent
585684f15b
commit
31460ee6be
13 changed files with 431 additions and 44 deletions
16
text.go
16
text.go
|
@ -173,22 +173,6 @@ func fetchAndCacheResults(query, safe, lang string, page, resultsPerPage int) []
|
|||
return combinedResults
|
||||
}
|
||||
|
||||
func paginateResults(results []TextSearchResult, page, resultsPerPage int) []TextSearchResult {
|
||||
startIndex := (page - 1) * resultsPerPage
|
||||
endIndex := startIndex + resultsPerPage
|
||||
|
||||
log.Printf("Paginating results: startIndex=%d, endIndex=%d, totalResults=%d", startIndex, endIndex, len(results))
|
||||
|
||||
if startIndex >= len(results) {
|
||||
return []TextSearchResult{}
|
||||
}
|
||||
if endIndex > len(results) {
|
||||
endIndex = len(results)
|
||||
}
|
||||
|
||||
return results[startIndex:endIndex]
|
||||
}
|
||||
|
||||
func sourceOrder(source string) int {
|
||||
switch source {
|
||||
case "Google":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue