fix(server): case-insensitive doc keyword search + not-found classification
Make document keyword search case-insensitive (LOWER(...) LIKE LOWER(?)) in the list filter and SearchKnowledge / SearchKnowledgeInScopes paths so a query and its differently-cased variant return the same results. Classify not-found consistently as HTTP 404 (not 500) so clients read a permanent resource.not_found instead of a retryable 5xx: map the document / chunk not-found sentinels in the KB-access middleware (typed ErrChunkNotFound via errors.Is), and return 404 for a missing message on the continue-stream and message-delete endpoints.
This commit is contained in:
@@ -26,8 +26,11 @@ var (
|
||||
ErrInvalidFileType = errors.New("unsupported file type")
|
||||
// ErrInvalidURL is returned when an invalid URL is provided
|
||||
ErrInvalidURL = errors.New("invalid URL")
|
||||
// ErrChunkNotFound is returned when a requested chunk cannot be found
|
||||
ErrChunkNotFound = errors.New("chunk not found")
|
||||
// ErrChunkNotFound is returned when a requested chunk cannot be found.
|
||||
// Aliases the repository sentinel so a chunk-not-found from the repo
|
||||
// errors.Is-matches at the service and middleware layers (a single
|
||||
// identity instead of two string-equal-but-distinct errors).
|
||||
ErrChunkNotFound = repository.ErrChunkNotFound
|
||||
// ErrDuplicateFile is returned when trying to add a file that already exists
|
||||
ErrDuplicateFile = errors.New("file already exists")
|
||||
// ErrDuplicateURL is returned when trying to add a URL that already exists
|
||||
|
||||
Reference in New Issue
Block a user