0

I use postgresql with EntityFramework Core 7.0 and build search vector with the default GIN method from 2 columns Title and Description of Products table, both of type string:

        builder.HasGeneratedTsVectorColumn(
                   p => p.SearchVector,
                   "english",  // Text search config
                   p => new { p.Title, p.Description })  // Included properties
               .HasIndex(p => p.SearchVector)
               .HasMethod("GIN"); // Index method on the search vector (GIN or GIST)

This produces a SearchVector column of type tstype in the Products table. Taking a closer look, this column contains partial word of the Title and/or Description columns. For example, the word glucose would only have glucos in the search vector column. So, searching for glucose keyword in my web application using .Where(record => record.p.SearchVector.Matches(EF.Functions.ToTsQuery(keyword))) would end up with empty result set. This is disappointing or what do I miss?

Kok How Teh
  • 3,298
  • 6
  • 47
  • 85

0 Answers0