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
/* * Redis-OM: 0.7.6 * dotnet core 8.0 * OS Program Run: Windows 10 22H2 * Redis Info: * redis_version:7.4.1 * redis_git_sha1:00000000 * redis_git_dirty:0 * redis_build_id:5918102922f65a0d * redis_mode:standalone * os:Linux 5.15.0-124-generic x86_64 * arch_bits:64 * monotonic_clock:POSIX clock_gettime * multiplexing_api:epoll * atomicvar_api:c11-builtin * gcc_version:11.4.0 */usingBugRedisOM;usingRedis.OM;usingStackExchange.Redis;/*[Document(StorageType = StorageType.Json, Prefixes = new[] { "BugTest:DesktopStatusEventLog" }, IndexName = "bug-desktopstatuseventlog-idx")]public class DesktopStatusEventLog{ [RedisIdField] public string Id { get; set; } = string.Empty; [Indexed] public long DateTime { get; set; } [Indexed] public string Desktop { get; set; }}*/varredis=ConnectionMultiplexer.Connect("10.128.1.127:6389,password=p5tg3mjyQxhE");varprovider=newRedisConnectionProvider(redis);provider.Connection.CreateIndex(typeof(DesktopStatusEventLog));varEventLogsSet=provider.RedisCollection<DesktopStatusEventLog>();string[]desktops=["D1","D2","D3","D4","D5","D6"];if(!EventLogsSet.Any()){longnow=DateTimeOffset.Now.ToUnixTimeSeconds();longdtStart=now-1440*60-360*60;longdtEnd=now;varrnd=newRandom(570);vareventLogs=newList<DesktopStatusEventLog>();foreach(varitemindesktops){for(vardt=dtStart;dt<dtEnd;dt+=rnd.Next(2,100*60)){eventLogs.Add(newDesktopStatusEventLog(){Id=Guid.NewGuid().ToString(),Desktop=desktops[rnd.Next(desktops.Length)],DateTime=dt});}}foreach(varitemineventLogs){EventLogsSet.Insert(item);}}varnames=EventLogsSet.AsQueryable().Select(x =>x.Desktop).ToArray();
Erro is:
System.InvalidOperationException: 'Searches can only be performed on objects decorated with a RedisObjectDefinitionAttribute that specifies a particular index'
and StackTrace is:
at Redis.OM.Common.ExpressionTranslator.BuildQueryFromExpression(Expression expression, Type type, Expression mainBooleanExpression, Type rootType)
at Redis.OM.Searching.RedisCollectionEnumerator`1..ctor(Expression exp, IRedisConnection connection, Int32 chunkSize, RedisCollectionStateManager stateManager, Expression`1 booleanExpression, Boolean saveState, Type rootType, Type type)
at Redis.OM.Searching.RedisCollection`1.GetEnumerator()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at Program.<Main>$(String[] args) in ...............:line 67
The text was updated successfully, but these errors were encountered:
Hi
Sample code:
Erro is:
and StackTrace is:
The text was updated successfully, but these errors were encountered: