Closed scme0 closed 5 months ago
Tested and it work for simple cases, what does not work is mostly due to our current implementation of meilisearch syncing.
Enums are stored as integer and not string values so comparisons fail DateTime/DateOnly are stored as string (and not unix timestamps) so meilisearch treat them as basic strings (see doc)
Tested and it work for simple cases, what does not work is mostly due to our current implementation of meilisearch syncing.
Enums are stored as integer and not string values so comparisons fail DateTime/DateOnly are stored as string (and not unix timestamps) so meilisearch treat them as basic strings (see doc)
@zoriya I've updated the sync code to send enums as strings and DateTime
/DateOnly
s as unix timestamps. I've also made it resolve all elements in any enumerable types (for instance genres is an array of enums) so they are also filterable mith meili.
Now genres
, dateAir
, startAir
, and endAir
all seem to work correctly.
I have a few questions:
Great job!
Yeah, I think doing that as part of the current migration process would be the easiest. Meilisearch works with upserts so we could just do something like:
for item in db.{Movie,Show,...}:
meili.CreateOrUpdate(item)
After the discussion in #480, I want to rework migrations, but I don't think this will be done soon. Let's just use it inside the migration container for now (this would require adding meilisearch as a dependency of the migration container in docker-compose
files).
Metadata refreshes also updates meilisearch, so the database can't drift too much. I'm fine not solving the drift issue if meili was unavailable during a db update for now.
Ah yep, that would probably work. Meilisearch should be available when the migration is running as it doesn't depend on anything else?
I could look into it later.
How often does the metadata refresh?
Depend on the air date of the item. Here is the snipet responsible for calculating the next refresh date:
public static DateTime ComputeNextRefreshDate(DateOnly airDate)
{
int days = DateOnly.FromDateTime(DateTime.UtcNow).DayNumber - airDate.DayNumber;
return days switch
{
<= 4 => DateTime.UtcNow.AddDays(1),
<= 21 => DateTime.UtcNow.AddDays(14),
_ => DateTime.UtcNow.AddMonths(2)
};
}
@zoriya This is ready for another review when you have some time 🙏
Apart from the escaping issue, it looks good. Do you want me to add the meilisearch's migration, or do I leave that to you?
Apart from the escaping issue, it looks good. Do you want me to add the meilisearch's migration, or do I leave that to you?
What migration are you talking about? Adding a database migration which updates all documents in meilisearch?
Yes
Required if we want to seamlessly add filtering to the browse page. Otherwise filtering won't work when users use the Search bar.
I've now tested this and it seems to work with enums (
genres
) and dates (airDate
,startAir
,endAir
).