c3f53eb470
Slice 4 of search-core: when an exact free-text search returns zero results, fall back to pg_trgm word_similarity on the subject (explicit 0.3 threshold — pg_trgm's default 0.6 misses real typos like 'recieved'->'received' ~0.39). Fallback-only, so it never dilutes good exact matches; fuzzy hits get no ts_headline. Migration enables the pg_trgm extension (CREATE EXTENSION IF NOT EXISTS — idempotent). Also relocates the EmailSummaryDto.MatchHighlight note to an XML doc: a comment inside the record's parameter list was tripping dotnet-format's whitespace check on every commit (mutating format wouldn't fix it) — moving it out clears that drift for good. Verified end-to-end vs a live Postgres via throwaway test (removed): typo 'recieved' fuzzy-matched a subject with 'received'. Build + all 40 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
679 B
C#
25 lines
679 B
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace InboxIntel.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class EnablePgTrgm : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.Annotation("Npgsql:PostgresExtension:pg_trgm", ",,");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.OldAnnotation("Npgsql:PostgresExtension:pg_trgm", ",,");
|
|
}
|
|
}
|
|
}
|