You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding .MultiTenanted() to the document mapping the query crashes with the following exception. Without .MultiTenanted everything works as expected.
Marten encountered an exception executing
select d.id, d.data from public.mt_doc_ngramdoc as d where (d.tenant_id = $1 and (public.mt_grams_vector(d.data ->> 'NGramString') @@ public.mt_grams_query($2) and d.ctid in (select ctid from )));
: *DEFAULT*
: some
Npgsql.PostgresException (0x80004005): 42601: syntax error at or near ")"
Repro
var host = Host.CreateDefaultBuilder()
.ConfigureServices((ctx, services) =>
{
services.AddMarten(opts =>
{
opts.Connection(connectionString);
opts.Schema.For<NGramDoc>()
.NgramIndex(x => x.NGramString)
.MultiTenanted();
})
.ApplyAllDatabaseChangesOnStartup()
.UseLightweightSessions();
})
.Build();
await using var scope = host.Services.CreateAsyncScope();
var session = scope.ServiceProvider.GetRequiredService<IDocumentSession>();
session.Store(new NGramDoc
{
SomeList = ["foo", "bar"],
NGramString = "something searchable"
});
await session.SaveChangesAsync();
var result = await session.Query<NGramDoc>()
.Where(x => x.NGramString.NgramSearch("some") && x.SomeList.Any(y => y.StartsWith("fo")))
.ToListAsync();
Console.WriteLine("Results: " + result.Count);
await host.StartAsync();
public class NGramDoc
{
public Guid Id { get; set; }
public List<string> SomeList { get; set; } = new();
public string NGramString { get; set; } = "";
}
The text was updated successfully, but these errors were encountered:
When adding .MultiTenanted() to the document mapping the query crashes with the following exception. Without .MultiTenanted everything works as expected.
Repro
The text was updated successfully, but these errors were encountered: