Indexing issue

Topics: Troubleshooting
Jan 28, 2014 at 1:05 PM
Edited Jan 28, 2014 at 1:05 PM
I keep getting this in orchard logFile
2014-01-28 14:01:24,236 [14] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
NHibernate.ObjectNotFoundException: No row with the given identifier exists[Orchard.ContentManagement.Records.ContentTypeRecord#31]
   at NHibernate.Impl.SessionFactoryImpl.DefaultEntityNotFoundDelegate.HandleEntityNotFound(String entityName, Object id) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionFactoryImpl.cs:line 84
   at NHibernate.Proxy.AbstractLazyInitializer.CheckTargetState() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Proxy\AbstractLazyInitializer.cs:line 261
   at NHibernate.Proxy.AbstractLazyInitializer.Initialize() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Proxy\AbstractLazyInitializer.cs:line 127
   at NHibernate.Proxy.AbstractLazyInitializer.GetImplementation() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Proxy\AbstractLazyInitializer.cs:line 191
   at NHibernate.Proxy.DefaultLazyInitializer.Intercept(InvocationInfo info) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Proxy\DefaultLazyInitializer.cs:line 37
   at ContentTypeRecordProxy.get_Name()
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in d:\Projects\Orchard1.7.1\src\Orchard\ContentManagement\DefaultContentManager.cs:line 219
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in d:\Projects\Orchard1.7.1\src\Orchard\ContentManagement\DefaultContentManager.cs:line 131
   at Orchard.Indexing.Services.IndexingTaskExecutor.<BatchIndex>b__0(ContentItemVersionRecord versionRecord)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Orchard.Indexing.Services.IndexingTaskExecutor.BatchIndex(String indexName, String settingsFilename, IndexSettings indexSettings)
   at Orchard.Indexing.Services.IndexingTaskExecutor.UpdateIndexBatch(String indexName)
   at Orchard.Indexing.Services.UpdateIndexScheduler.UpdateIndex(String indexName)
   at Orchard.Events.DelegateHelper.<>c__DisplayClass2b`2.<BuildAction>b__2a(Object target, Object[] p) in d:\Projects\Orchard1.7.1\src\Orchard\Events\DelegateHelper.cs:line 116
   at Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String messageName, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\Projects\Orchard1.7.1\src\Orchard\Events\DefaultOrchardEventBus.cs:line 81
   at Orchard.Events.DefaultOrchardEventBus.TryInvoke(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 arguments, IEnumerable& returnValue) in d:\Projects\Orchard1.7.1\src\Orchard\Events\DefaultOrchardEventBus.cs:line 67
   at Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary`2 eventData, IEnumerable& returnValue) in d:\Projects\Orchard1.7.1\src\Orchard\Events\DefaultOrchardEventBus.cs:line 53
This is probably related due to manual attempt to delete all traces of one module form database. I'm guessing something got left behind.

Any suggestions?
Jan 28, 2014 at 1:09 PM
IndexingTaskExecutor's private method "BatchIndex" breaks with exception here...
 var contentItems = _contentRepository
                    .Table.Where(versionRecord => versionRecord.Published && versionRecord.Id > indexSettings.LastContentId)
                    .OrderBy(versionRecord => versionRecord.Id)
                    .Take(ContentItemsPerLoop)
                    .ToList()
                    .Select(versionRecord => _contentManager.Get(versionRecord.ContentItemRecord.Id, VersionOptions.VersionRecord(versionRecord.Id)))
                    .Distinct()
                    .ToList();
I've took a brief look trough the DB and I couldn't figure out what's the chatch.