if (comments) users will want to search partially on dates, then honestly: the best thing to do is for your code to inspect their input, and parse that into a range query. so; if you see "12/04", you might parse that into a day (in the current year, applying your choice of dd/mm vs mm/dd), and then do a range query on >= that day and < the next day. similarly, if you see "2021", your code should do the same, but as a range query. trying to do a naïve partial match is not only computationally expensive (and hard to write as a query): it also isn't very useful to the user. searching just on "2" for example - just isn't meaningful as a "contains" query.

then what you have is:

(var startinc, var endexc) = parserange(searchterm);
samuraisqueryable = samuraisqueryable.where(
    x => x.createddate >= startinc && x.creationdate < endexc);

Related Query

More Query from same tag