PGroonga.EntityFrameworkCore
3.1.0
PGroonga extension for Npgsql.EntityFrameworkCore.PostgreSQL (PostgreSQL / Npgsql Entity Framework Core provider). It enable the ability to do full text search, especially Chinese, Japanese, and so on, with EntityFramework Core, PostgreSQL and Groonga.


EF.Functions.Pgroonga* only works with Npgsql.EntityFrameworkCore.PostgreSQL >= 2.2.6 and >= 3.0.1 due to aspnet/EntityFrameworkCore#13454.
public class ApplicationDbContext : DbContext
{
// ...
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// ...
modelBuilder.Entity<Post>()
.HasIndex(g => g.Content)
.HasMethod("pgroonga")
.HasOperators("pgroonga_varchar_full_text_search_ops_v2");
}
}
public class Startup
{
// ...
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContextPool<ApplicationDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"),
builder => builder.UsePGroonga()));
// ...
}
}
var posts = await _dbContext.Posts.Where(g => g.Content.SimilarSearch(q))
.OrderByDescending(g => EF.Functions.PgroongaScore())
.ToArrayAsync();For more information, see PGroongaLinqExtensions and PGroongaDbFunctionsExtensions.
LIKELIKEILIKEILIKE&@ Match&@~ Query&@* SimilarSearch&` ScriptQuery&@| MatchIn&@~| QueryIn&^ PrefixSearch&^~ PrefixRkSearch&^| PrefixSearchIn&^~| PrefixRkSearchIn&~ RegexpMatchpgroonga_commandpgroonga_command_escape_valuepgroonga_escapepgroonga_flushpgroonga_highlight_htmlpgroonga_is_writablepgroonga_match_positions_bytepgroonga_match_positions_characterpgroonga_normalizepgroonga_query_escapepgroonga_query_expandpgroonga_query_extract_keywordspgroonga_set_writablepgroonga_scorepgroonga_snippet_htmlpgroonga_table_namepgroonga_wal_applypgroonga_wal_truncateThe MIT License
More info see LICENSE