mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Sort citations by filename and page number
Updated the return statement in the `VectorSearchService` class to return citations sorted by `FileName` and `PageNumber`, improving the organization of the output.
This commit is contained in:
@@ -187,7 +187,7 @@ public partial class VectorSearchService(IServiceProvider serviceProvider, Appli
|
|||||||
|
|
||||||
// Remove all content between 【 and 】.
|
// Remove all content between 【 and 】.
|
||||||
var cleanText = RemoveCitationsRegEx.Replace(text, string.Empty).TrimEnd();
|
var cleanText = RemoveCitationsRegEx.Replace(text, string.Empty).TrimEnd();
|
||||||
return (cleanText, citations);
|
return (cleanText, citations.OrderBy(c => c.FileName).ThenBy(c => c.PageNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratedRegex(@"<citation\s+document-id=(?:""|'|)(?<documentId>[^""']*)(?:""|'|)\s+chunk-id=(?:""|'|)(?<chunkId>[^""']*)(?:""|'|)\s+filename=(?:""|'|)(?<filename>[^""']*)(?:""|'|)\s+page-number=(?:""|'|)(?<pageNumber>[^""']*)(?:""|'|)\s+index-on-page=(?:""|'|)(?<indexOnPage>[^""']*)(?:""|'|)>\s*(?<quote>.*?)\s*</citation>", RegexOptions.Singleline)]
|
[GeneratedRegex(@"<citation\s+document-id=(?:""|'|)(?<documentId>[^""']*)(?:""|'|)\s+chunk-id=(?:""|'|)(?<chunkId>[^""']*)(?:""|'|)\s+filename=(?:""|'|)(?<filename>[^""']*)(?:""|'|)\s+page-number=(?:""|'|)(?<pageNumber>[^""']*)(?:""|'|)\s+index-on-page=(?:""|'|)(?<indexOnPage>[^""']*)(?:""|'|)>\s*(?<quote>.*?)\s*</citation>", RegexOptions.Singleline)]
|
||||||
|
|||||||
Reference in New Issue
Block a user