Orchard- All Indexes Rebuild Failing - indexing

I have been having an issue where Indexes for Search have been failing for a while it seemed like new indexes weren't getting created. I went to rebuild the Search index using that rebuild button, and all the documents that were previously indexed were no longer indexed.
I followed this article without results: Orchard - Search & Indexing issue
This did not work. I think probably because
App_data\Sites\Default\Search.settings.xml
doesn't get generated in the first place. I do however see a file:
App_data\Sites\Default\Search.settings.xml.lock
I believe the Orchard.Indexing.Services.IndexingTaskExecutor UpdateIndexBatch method is failing because my impression is the lock file would be created and then deleted if it was working. Here is a possibly relevant error:
2021-01-08 00:00:41,174 [48] Orchard.Exceptions.DefaultExceptionPolicy - Default - An unexpected exception was caught
(null)
System.NullReferenceException: Object reference not set to an instance of an object.
at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints)
at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options)
at Orchard.Indexing.Services.IndexingTaskExecutor.b__0(ContentItemVersionRecord versionRecord)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at System.Linq.Enumerable.<DistinctIterator>d__641.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 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__DisplayClass2b2.b__2a(Object target, Object[] p)
at Orchard.Events.DefaultOrchardEventBus.TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, String messageName, String interfaceName, String methodName, IDictionary2 arguments, IEnumerable& returnValue) at Orchard.Events.DefaultOrchardEventBus.TryNotifyHandler(IEventHandler eventHandler, String messageName, String interfaceName, String methodName, IDictionary2 eventData, IEnumerable& returnValue)
Another error I see that I believe is related to the issue seems to occur in Orchard.Indexing.Handlers.InfosetFieldIndexingHandler
2021-01-08 00:00:02,236 [48] Orchard.ContentManagement.DefaultContentManager - Default - NullReferenceException thrown from IContentHandler by Orchard.Indexing.Handlers.InfosetFieldIndexingHandler
(null)
System.NullReferenceException: Object reference not set to an instance of an object.
at Orchard.Fields.Fields.DateTimeField.get_DateTime()
at Orchard.Fields.Drivers.DateTimeFieldDriver.b__15(DateTimeField field)
at Orchard.ContentManagement.Handlers.DescribeMembersContext.Enumerate[TField](Func1 enumerate) at Orchard.Fields.Drivers.DateTimeFieldDriver.Describe(DescribeMembersContext context) at Orchard.ContentManagement.Drivers.ContentFieldDriver1.Orchard.ContentManagement.Drivers.IContentFieldDriver.Describe(DescribeMembersContext context)
at Orchard.Indexing.Handlers.InfosetFieldIndexingHandler.<.ctor>b__0(IndexContentContext context, InfosetPart cp)
at Orchard.ContentManagement.Handlers.ContentHandler.InlineStorageFilter1.Indexing(IndexContentContext context, TPart instance) at Orchard.ContentManagement.Handlers.StorageFilterBase1.Orchard.ContentManagement.Handlers.IContentStorageFilter.Indexing(IndexContentContext context)
at Orchard.ContentManagement.Handlers.ContentHandler.Orchard.ContentManagement.Handlers.IContentHandler.Indexing(IndexContentContext context)
at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass99.b__97(IContentHandler handler)
at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable1 events, Action1 dispatch, ILogger logger)
To note, I did try to generate a new index and just have it index news articles. This did not work, or generate the settings.xml file either.
Is there a database location that I should be looking at that could be containing null dates, or should I be looking elsewhere? Any help would be greatly appreciated.
Edit: It has been two days and no responses, so I made a post with updated details on git (in case someone is looking for an answer to the same question, and in case git hub has an answer git hub issue)

The solution was found. There was some null data within ContentItemRecord. The null Data and ContentType_id resulted in no indexes being built even unrelated index.
Here is the query we used to find the bad data. The xxxxxx would need to be replaced by whatever prefix is associated with your table, but gives you an idea what to do.
SELECT *
FROM [dbo].[xxxxxx_Orchard_Framework_ContentItemVersionRecord] civr
LEFT JOIN [dbo].[xxxxxx_Orchard_Framework_ContentItemRecord] cir ON civr.ContentItemRecord_id = cir.Id
LEFT JOIN [dbo].[xxxxxx_Orchard_Framework_ContentTypeRecord] ctr ON cir.ContentType_id = ctr.Id
WHERE cir.Id IS NULL OR cir.Data IS NULL OR ctr.Id IS NULL

Related

Is it possible to use "Work items and direct link" type of query with Azure DevOps Migration tool

I'm trying to use the "azure-devops-migration-tool" to migrate Work items. What I'm trying to achieve is to query all items with closed not set and all the directly linked items with them in one query. This can be done in Azure DevOps UI, but I can't get the same query working in the tool.
An example query would be like this:
"QueryBit": "AND ( [Source].[System.WorkItemType] <> '' AND [Source].[System.State] <> '' AND [Source].[Microsoft.VSTS.Common.ClosedDate] = '') AND ([Target].[System.WorkItemType] <> '')"
Once running the tool I get an exception
[EXCEPTION] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF51005: The query references a field that does not exist. The error is caused by «Source.[System.WorkItemType]».
at Microsoft.TeamFoundation.WorkItemTracking.Client.Query.Initialize(WorkItemStore store, String wiql, IDictionary context, Int32[] ids, Int32[] revs, Boolean dayPrecision)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Query(String wiql, IDictionary context)
at VstsSyncMigrator.Engine.TfsQueryContext.Execute() in d:\a\1\s\src\VstsSyncMigrator.Core\Execution\ComponentContext\TfsQueryContext.cs:line 72
migration.exe Warning: 0 : [EXCEPTION] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF51005: The query references a field that does not exist. The error is caused by «Source.[System.WorkItemType]».
at Microsoft.TeamFoundation.WorkItemTracking.Client.Query.Initialize(WorkItemStore store, String wiql, IDictionary context, Int32[] ids, Int32[] revs, Boolean dayPrecision)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Query(String wiql, IDictionary context)
at VstsSyncMigrator.Engine.TfsQueryContext.Execute() in d:\a\1\s\src\VstsSyncMigrator.Core\Execution\ComponentContext\TfsQueryContext.cs:line 99
at VstsSyncMigrator.Engine.WorkItemMigrationContext.InternalExecute() in d:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 101
at VstsSyncMigrator.Engine.MigrationContextBase.Execute() in d:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\MigrationContextBase.cs:line 35
Any suggestions?
Found the issue, and it was that the tool did not support to query from "WorkItemLinks".
It only supports "flat list of workitems type query"
try the wiql Editor plugin - https://marketplace.visualstudio.com/items?itemName=ottostreifel.wiql-editor
This lets you build queries with the UI and convert them to wiql with the editor. You can copy and paste them into your config file

OracleDataAdapter Started Returning error ORA-00942: table or view does not exist

Development Environment:
VB.NET
.net 4.5
ODP.NET
Oracle 11g
Hi there I have a weird problem, code in my development environment which has been working for a good number of years has suddenly stopped working. The OracleDataAdapter returns the error ORA-00942: table or view does not exist. However there is nothing wrong with the SQL that is passed to the adapter, the SQL executes successfully in SQLDeveloper. It looks like the issue is with my VS development environment, as a previously compiled version of the application runs as normal. I have re-compiled the entire VS solution and re-booted my development machine and then re-compiled without any joy.
The exact error returned is shown in the following log entry:
12|09:43:50|DOMAIN\USER|Trace| Oracle.DataAccess.Client.OracleException ORA-00942: table or view does not exist
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at QueryMain.uxBWFetch_DoWork(Object sender, DoWorkEventArgs e) in d:\users\USER\Documents_VSSWorkArea\PSALERTS 2017\PSALERTS Client\Query\QueryMain.vb:line 677
Here is the code which generates the error:
Dim myDataset As New DataSet
Dim myUtils As New Utils
_myConnection = New OracleConnection
_myConnection.ConnectionString = _connectStr
Try
_myDataAdapter = New OracleDataAdapter(SQLStatement, _myConnection)
_myDataAdapter.Fill(myDataset)
_myConnection.Close()
Catch ex As Exception
Throw
Finally
CType(_myConnection, IDisposable).Dispose()
End Try
Return myDataset
GC.Collect()
The error is generated when we try to fill the dataset:
_myDataAdapter.Fill(myDataset)
If anyone has encountered this situation could you please let me know, as it is driving me to distraction!!!
Kind Regards
Paul J.
Well now, don't I feel stupid. Turns out although my intention was to develop against our test database, the SQL generated within the code contained a hardcoded connect string which was pointing at production, and of course the code contains references to new tables which are not in production, hence the error message... DOH...

NullReferenceException in a query involving null foreign key

NullReferenceException in a query involving null foreign key
I have a VB project making use of an odata service and linq queries. (The previous sentence is full of things I've never done before, so this might get rough.)
There is an "Employees" table and an "Application" table, linked in a 1-to-1 relationship. I'm trying to figure out how to make use of that relationship to join the tables and query one field from each.
This query is the closest I've come (it compiles, unlike some other variations I tried):
Dim Emps = (From e In ctx.Employees Select e.FirstName, e.Application.AppNo)
I can even check how many records are in the result:
Console.WriteLine(Emps.Count)
and get a reasonable number. But any attempt to do anything else with the result causes an exception to be thrown. For eaxmple, I did this:
Console.WriteLine("----")
Console.WriteLine(Emps.FirstOrDefault.FirstName)
Console.WriteLine("====")
and it threw:
Unhandled Exception: System.NullReferenceException: An entry returned by the navigation property 'Application' is null and cannot be initialized. You should check for a null value before accessing this property.
at System.Data.Services.Client.Materialization.ODataEntityMaterializer.CheckEntryToAccessNotNull(MaterializerEntry entry, String name)
at System.Data.Services.Client.Materialization.ODataEntityMaterializer.ProjectionValueForPath(MaterializerEntry entry, Type expectedType, ProjectionPath path)
at System.Data.Services.Client.Materialization.ODataEntityMaterializerInvoker.ProjectionValueForPath(Object materializer, Object entry, Type expectedType, Object path)
at _dynamic_ODataEntityMaterializerInvoker_ProjectionValueForPath(Object , Object , Type , Object )
at lambda_method(Closure , Object , Object , Type )
at System.Data.Services.Client.ProjectionPlan.Run(ODataEntityMaterializer materializer, ODataEntry entry, Type expectedType)
at System.Data.Services.Client.Materialization.ODataEntityMaterializer.ReadImplementation()
at System.Data.Services.Client.MaterializeAtom.MoveNextInternal()
at System.Data.Services.Client.MaterializeAtom.MoveNext()
at System.Linq.Enumerable.<CastIterator>d__1`1.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Services.Client.DataServiceQueryProvider.ReturnSingleton[TElement](Expression expression)
at System.Data.Services.Client.DataServiceQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at odata.Odata.Main() in H:\Visual Studio 2015\Projects\odata\odata\Odata.vb:line 52
Notice that I got the exception about a null Application even though I was only trying to print the other field, which has nothing to do with Application, which I think is pretty weird. The exception occurred after the "----" was printed but before the "====".
I guess there is a null foreign key in at least one of the records (an Employee without an Application). In that case I'd like to have an empty string or some other placeholder value for e.Application.AppNo but I can't figure out how to tell it to do that.
In more SQL-like syntax, it would be
FROM Employees e
SELECT
e.FirstName,
CASE WHEN e.Application IS NOT NULL
THEN e.Application.AppNo
ELSE ''
END AS AppNo
But all attempts to twist that into a vb/linq statement have resulted in syntax errors.
It's possible I don't understand the schema well enough. I see other questions using explicit join syntax in linq, but I don't know how to do that here, since I don't know what the foreign key field is actually called; all I know is there's something in the odata magic that lets me use e.Application.foo where foo is a field in the Application table and e is an Employees record.
The documentation from the provider of the odata service is of very low quality. (Short code examples in VB, provided as screenshots not text; full dumps of the HTTP requests and responses corresponding to the sample queries, including one XML response over 50 pages long; and on the topic of authentication, a reference to the HTTP Basic "RCF")
UPDATE
The suggestion from Mark generated a new exception:
Unhandled Exception: System.NotSupportedException: Constructing or initializing instances of the type VB$AnonymousType_0`2[System.String,System.Object] with the expression (e.Application != null) is not supported.
at System.Data.Services.Client.ProjectionAnalyzer.NonEntityProjectionAnalyzer.VisitBinary(BinaryExpression b)
at System.Data.Services.Client.ALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.DataServiceALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.ALinqExpressionVisitor.VisitConditional(ConditionalExpression c)
at System.Data.Services.Client.ProjectionAnalyzer.NonEntityProjectionAnalyzer.VisitConditional(ConditionalExpression c)
at System.Data.Services.Client.ALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.DataServiceALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.ALinqExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
at System.Data.Services.Client.ALinqExpressionVisitor.VisitNew(NewExpression nex)
at System.Data.Services.Client.ProjectionAnalyzer.NonEntityProjectionAnalyzer.VisitNew(NewExpression nex)
at System.Data.Services.Client.ALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.DataServiceALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.ProjectionAnalyzer.NonEntityProjectionAnalyzer.Analyze(Expression e, PathBox pb, DataServiceContext context)
at System.Data.Services.Client.ProjectionAnalyzer.Analyze(LambdaExpression e, PathBox pb, DataServiceContext context)
at System.Data.Services.Client.ProjectionAnalyzer.AnalyzeResourceExpression(LambdaExpression lambda, ResourceExpression resource, DataServiceContext context)
at System.Data.Services.Client.ProjectionAnalyzer.Analyze(LambdaExpression le, ResourceExpression re, Boolean matchMembers, DataServiceContext context)
at System.Data.Services.Client.ResourceBinder.AnalyzeProjection(MethodCallExpression mce, SequenceMethod sequenceMethod, Expression& e)
at System.Data.Services.Client.ResourceBinder.VisitMethodCall(MethodCallExpression mce)
at System.Data.Services.Client.ALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.DataServiceALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.ALinqExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
at System.Data.Services.Client.ALinqExpressionVisitor.VisitMethodCall(MethodCallExpression m)
at System.Data.Services.Client.ResourceBinder.VisitMethodCall(MethodCallExpression mce)
at System.Data.Services.Client.ALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.DataServiceALinqExpressionVisitor.Visit(Expression exp)
at System.Data.Services.Client.ResourceBinder.Bind(Expression e, DataServiceContext context)
at System.Data.Services.Client.DataServiceQueryProvider.Translate(Expression e)
at System.Data.Services.Client.DataServiceQuery`1.QueryComponents(ClientEdmModel model)
at System.Data.Services.Client.DataServiceRequest.GetQuerySetCount(DataServiceContext context)
at System.Data.Services.Client.DataServiceQueryProvider.ReturnSingleton[TElement](Expression expression)
at System.Data.Services.Client.DataServiceQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at odata.Odata.Main() in H:\Visual Studio 2015\Projects\odata\odata\Odata.vb:line 51
This one happens at the attempt to print Emps.Count

WCF : An item with the same key has already been added

While testing WCF services with 150 Users, i got this exception.
Note : I am using MS Test Project for loadtesting of WCF Service. When load test is run for 100users, there is no exception.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Dynamic.ClassFactory.GetDynamicClass(IEnumerable1 properties) at System.Linq.Dynamic.DynamicExpression.CreateClass(IEnumerable`1 properties) at System.Linq.Dynamic.ExpressionParser.ParseNew() at System.Linq.Dynamic.ExpressionParser.ParseIdentifier() at System.Linq.Dynamic.ExpressionParser.ParsePrimaryStart() at System.Linq.Dynamic.ExpressionParser.ParsePrimary() at System.Linq.Dynamic.ExpressionParser.ParseUnary() at System.Linq.Dynamic.ExpressionParser.ParseMultiplicative() at System.Linq.Dynamic.ExpressionParser.ParseAdditive() at System.Linq.Dynamic.ExpressionParser.ParseComparison() at System.Linq.Dynamic.ExpressionParser.ParseLogicalAnd() at System.Linq.Dynamic.ExpressionParser.ParseLogicalOr() at System.Linq.Dynamic.ExpressionParser.ParseExpression() at System.Linq.Dynamic.ExpressionParser.Parse(Type resultType) at System.Linq.Dynamic.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) at System.Linq.Dynamic.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) at System.Linq.Dynamic.DynamicQueryable.Select(IQueryable source, String selector, Object[] values) at CustomEntities.Data.Repository.CustomEntitiesDataRepository.GetCustomEntityData(CriteriaDto criteriaDto) in d:\Projects\SRM\Services\Data\CustomEntities\CustomEntities.Data.Repository\CustomEntitiesDataRepository.cs:line 131 at CustomEntities.Data.Manager.CustomEntitiesDataManager.GetCustomEntityData(CriteriaDto criteriaDto) in d:\Projects\SRM\Services\Data\CustomEntities\CustomEntities.Data.Manager\CustomEntitiesDataManager.cs:line 69
If you look at your code, in CustomEntitiesDataRepository.cs at line 131, this line is triggering the issue. The custom entity you are returning is, at some level, trying to insert a value into a Dictionary<T,U>, but the key its using already exists.
Actually it looks like there's a concurrency issue in .Select(). See http://www.webr2.com/system-linq-dynamic-select-new-does-not-appear-to-be-thread-safe/
Easiest fix is to put some locking in your code around calls to Select

NHibernate.MappingException - Trouble Shooting Checklist (no persister for)

Here's a starter list:
if hbm is hand generated, is it an embedded resource?
if using FNH, does it pass a PerssistenceSpecification test?
if not using FNH, can you save and then load the persisted class?
use Ayende's "sanity checks"
I'm sure many of you have gotten this one at one point or another. But have you ever gotten it when you knew your mapping was set up correctly?
I started getting this exception after I started using a new repository design, but only in one scenario! PersistenceSpecification tests pass, as do all repository methods (using SQLite).
The scenario that leads to the exception is when legacy projects from a different db are converted to green field system. The legacy system is from a different database and has it's own session factory, which should be irrelevant because the error comes after previously unconverted Projects are retrieved and in memory.
As the routine tries to save these unconverted Projects into the new database, the exception is thrown, full stack trace below.
Any ideas on how to build up the trouble shooting check list and solves this problem?
Cheers,
Berryl
=== the Exception trace =====
failed: NHibernate.MappingException : No persister for: Smack.ConstructionAdmin.Domain.Model.Projects.Project
at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName)
at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName, Object obj)
at NHibernate.Engine.ForeignKeys.IsTransient(String entityName, Object entity, Nullable`1 assumed, ISessionImplementor session)
at NHibernate.Event.Default.AbstractSaveEventListener.GetEntityState(Object entity, String entityName, EntityEntry entry, ISessionImplementor source)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj)
NHibernate\Repository\FabioNHibRepository.cs(46,0): at Smack.Core.Data.NHibernate.Repository.FabioNHibRepository`1.Add(T item)
LegacyConversion\LegacyBatchUpdater.cs(20,0): at Smack.ConstructionAdmin.Data.LegacyConversion.LegacyBatchUpdater.ConvertOpenLegacyProjects(ILegacyProjectDao legacyProjectDao, IProjectRepository greenProjectRepository)
Data\Brownfield\ProjectBatchUpdate_SQLiteTests.cs(19,0): at Smack.ConstructionAdmin.Tests.Data.Brownfield.ProjectBatchUpdate_SQLiteTests.Test()
The problem here turned out to be that I was inadvertently binding the same session context to both the legacy and greenfield db session factories, first to the greenfield and then the legacy.