foundatiofx / foundatio.repositories Goto Github PK
View Code? Open in Web Editor NEWGeneric repositories
License: Apache License 2.0
Generic repositories
License: Apache License 2.0
Some items may fail due to version change or multiple bulk results running at the same time. We should retry this and possibly return the number of modified documents (bulkResult.Items). Also, we should invalidate the cache before returning..
We need to ensure though that this doesn't affect cache invalidation.
Patternize multi-tenant custom field handling
I removed some usages of JSON.NET down to where our only usage is pretty much the JSON patch support.
Spent some time taking a look at json-everything's JsonPatch
support and it only uses JSON Pointers for paths and does not support some of the things we are doing where we are allowing full JSON Path support where we can do things like $.books[?(@.author == 'John Steinbeck')]
to remove all array elements from the books array that has an author sub-property that matches John Steinbeck
. So basically we would need to make major changes to their libraries or talk them into supporting JSON Path expressions even though the unofficial JSON Patch spec only supports JSON Pointer.
Originally posted by @ejsmith in #96 (comment)
Found this issue where someone asked him and he said no to supporting JSON Path.
Originally posted by @ejsmith in #96 (comment)
Comment for previous history:
For Json Patching it would be nice to see if we can get it to work without a dependency or we can internalize the dependency. I see several spots doing patching
Originally posted by @niemyjski in #96 (comment)
We need to be able to resume reindexing by keeping the last scroll id + a list of document id's in a cache set.
A final request to elastic that is created after parsing a filter expression has a range filter but without a timezone specified.
More info here:
https://shusson.info/post/elasticsearch-range-query-datemath-and-timezones
Failing test:
`[Fact]
public async Task GetWithDateRangeFilterExpressionHonoringTimeZoneAsync() {
Log.MinimumLevel = LogLevel.Trace;
var chicagoTimeZone = TZConvert.GetTimeZoneInfo("America/Chicago");
var asiaTimeZone = TZConvert.GetTimeZoneInfo("Asia/Shanghai");
var format = @"yyyy-MM-ddTHH\\:mm\\:ss";
var utcNow = SystemClock.UtcNow;
var chicagoNow = TimeZoneInfo.ConvertTimeFromUtc(utcNow, chicagoTimeZone);
var asiaNow = TimeZoneInfo.ConvertTimeFromUtc(utcNow, asiaTimeZone);
_logger.LogInformation($"UTC: {utcNow:o} Chicago: {chicagoNow:o} Asia: {asiaNow:o}");
var employee = await _employeeRepository.AddAsync(EmployeeGenerator.Generate(nextReview: utcNow), o => o.ImmediateConsistency());
Assert.NotNull(employee?.Id);
var filter = $"next:>={utcNow.SubtractHours(1).ToString(format)} AND next:<={utcNow.ToString(format)}";
var results = await _employeeRepository.FindAsync(o => o.FilterExpression(filter));
_logger.LogInformation($"Count: {results.Total} - UTC range");
Assert.NotNull(results);
Assert.Equal(1, results.Documents.Count);
Assert.Equal(1, results.Page);
Assert.False(results.HasMore);
Assert.Equal(1, results.Total);
filter = $"next:>={chicagoNow.SubtractHours(1).ToString(format)} AND next:<={chicagoNow.ToString(format)}";
results = await _employeeRepository.FindAsync(o => o.FilterExpression(filter).BuildOption("timezone", "America/Chicago"));
_logger.LogInformation($"Count: {results.Total} - Chicago range");
Assert.NotNull(results);
Assert.Equal(1, results.Documents.Count);
Assert.Equal(1, results.Page);
Assert.False(results.HasMore);
Assert.Equal(1, results.Total);
filter = $"next:>={asiaNow.SubtractHours(1).ToString(format)} AND next:<={asiaNow.ToString(format)}";
results = await _employeeRepository.FindAsync(o => o.FilterExpression(filter).BuildOption("timezone", "Asia/Shanghai"));
_logger.LogInformation($"Count: {results.Total} - Asia range");
Assert.NotNull(results);
Assert.Equal(1, results.Documents.Count);
Assert.Equal(1, results.Page);
Assert.False(results.HasMore);
Assert.Equal(1, results.Total);
}`
Foundatio.Repositories Support entity farmework??
For example, we need to refresh the indexes after we do soft deletes on events so the stacks can be deleted properly.
There could be added documents, so should we also send out a Added ChangeType notification? I almost think that we should have an event handler for Documents Saved and DocumentsAdded that just handles notifications. This would ensure that it's always executed properly.
Currently aggregations can only return number results. We need to support complex aggregations (geo + string data etc).
Currently users of this library using System.Text.Json (STJ) cannot return search aggregation results (from redis cache, or from api endpoints) due to serialization dependencies on Newtonsoft.Json. Our goal is to update the Foundatio.Repositories to work with System.Text.Json. However, we don’t want to break other applications so we need to support Newtonsoft.Json by leaving the existing JsonConverters in place unless we can find a way to support both out of the box without the dependency or an easy way for it to be configured externally.
I see this happening in the following steps:
AggregationQueryTests.GetTermAggregationsWithTopHitsAsync()
. string systemTextJson = System.Text.Json.JsonSerializer.Serialize(result);
Assert.Equal(json, systemTextJson);
roundTripped = System.Text.Json.JsonSerializer.Deserialize<CountResult>(systemTextJson);
Assert.Equal(10, roundTripped.Total);
Assert.Equal(1, roundTripped.Aggregations.Count);
Assert.Equal(10, roundTripped.Aggregations.Terms<int>("terms_age").Buckets.Count);
bucket = roundTripped.Aggregations.Terms<int>("terms_age").Buckets.First(f => f.Key == 19);
Assert.Equal(1, bucket.Total);
Foundatio.Repositories.Utility
to System.Text.Json and then add the json converter attributes next to the existing converter attributes. This will fix the round trip part of reading the json text.Not sure if this link will help on the converters: https://bengribaudo.com/blog/2022/02/22/6569/recursive-polymorphic-deserialization-with-system-text-json
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.