ultisuite-backend/internal/websearch/query.go
R3D347HR4Y 556d5f416d Enhance API and configuration for contact discovery and public sharing
- Introduced new endpoints for contact discovery, including scanning, listing, and managing discovered contacts.
- Implemented retry logic for handling missing DAV credentials during contact operations.
- Added public share functionality for drive API, allowing users to manage public shares, including upload, delete, and rename operations.
- Updated Nextcloud configuration to support public share links and improved error handling for public share permissions.
- Enhanced logging and validation across contact and drive APIs for better error tracking and user feedback.
- Added tests for new contact matching and ranking functionalities to ensure accuracy and reliability.
2026-06-06 20:27:02 +02:00

41 lines
1.1 KiB
Go

package websearch
import (
"fmt"
"strings"
)
func BuildContactSearchQuery(firstName, lastName, middleName, company, jobTitle, city string) string {
var parts []string
name := strings.TrimSpace(strings.Join([]string{
strings.TrimSpace(firstName),
strings.TrimSpace(middleName),
strings.TrimSpace(lastName),
}, " "))
if name != "" {
parts = append(parts, name)
}
if company = strings.TrimSpace(company); company != "" {
parts = append(parts, company)
}
if jobTitle = strings.TrimSpace(jobTitle); jobTitle != "" {
parts = append(parts, jobTitle)
}
if city = strings.TrimSpace(city); city != "" {
parts = append(parts, city)
}
return strings.Join(parts, " ")
}
func FormatResultsForPrompt(results []Result) string {
if len(results) == 0 {
return ""
}
var b strings.Builder
b.WriteString("Résultats de recherche en ligne, attention ces resultats peuvent n'avoir aucun lien avec le contact ou concerner des homonymes:\n")
for i, r := range results {
fmt.Fprintf(&b, "\n%d. Titre: %s\n URL: %s\n Description: %s", i+1, r.Title, r.URL, r.Description)
}
return b.String()
}