"Ambiguous match found" when re-indexing website content

Vote:
 

Hello,

We’re using Episerver Find to index the content of a website.

After backstaging the production database to our local dev server I tried to re-index the website content to our dev instance of Episerver Find using the scheduled job (manually).

When trying to re-index the scheduled job throws several exceptions:

Indexing job [mysite.dev] [content]: Reindexing completed. ExecutionTime: 3 minutes 2 seconds Number of contents indexed: 1931 Number of content errors: 0 Number of batch errors: 5
WIN-L6B2S8QVFBU: An exception occurred while indexing (Batch): Ambiguous match found. (see log for more information)
WIN-L6B2S8QVFBU: An exception occurred while indexing (Batch): The request was aborted: The request was canceled. (see log for more information)
WIN-L6B2S8QVFBU: An exception occurred while indexing (Batch): Ambiguous match found. (see log for more information)
WIN-L6B2S8QVFBU: An exception occurred while indexing (Batch): Ambiguous match found. (see log for more information)
WIN-L6B2S8QVFBU: An exception occurred while indexing (Batch): The request was aborted: The request was canceled. (see log for more information)

Indexing job [Global assets and other data] [content]: Reindexing completed. ExecutionTime: 0 minutes 2 seconds Number of contents indexed: 0

When I checked the log there are several occurences of the two following errors:

2016-01-27 12:21:19,094 [9] WARN EPiServer.Web.PermanentLinkMapper: Failed to resolve 'http://Check out this link on Instagram'
System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.UriBuilder..ctor(String uri)
at EPiServer.UrlBuilder.Init(String url)
at EPiServer.Web.PermanentLinkMapper.TryToPermanent(String url, String& permanentUrl)
System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.UriBuilder..ctor(String uri)
at EPiServer.UrlBuilder.Init(String url)
at EPiServer.Web.PermanentLinkMapper.TryToPermanent(String url, String& permanentUrl)


and

2016-01-27 12:21:31,863 [9] ERROR EPiServer.Find.Cms.ContentIndexer: MyComp: An exception occurred while indexing (Batch): Ambiguous match found.
System.Reflection.AmbiguousMatchException: Ambiguous match found.
at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetProperty(String name)
at EPiServer.Find.Cms.ContentExtensions.d__10.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.d__1.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at EPiServer.Find.Cms.ContentExtensions.SearchText(IContentData contentData)
at EPiServer.Find.DelegateValueProvider`2.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at EPiServer.Find.Api.BulkActionConverter.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at EPiServer.Find.Json.Serializer.SerializeToTextWriter(JsonSerializer serializer, Object value, TextWriter textWriter)
at EPiServer.Find.Json.Serializer.SerializeObjectsToJsonRequest(JsonSerializer serializer, IJsonRequest jsonRequest, IEnumerable values)
at EPiServer.Find.Api.BulkCommand.Execute()
at EPiServer.Find.Cms.ContentIndexer.IndexWithRetry(IContent[] contents, Int32 maxRetries)
at EPiServer.Find.Cms.ContentIndexer.Index(IEnumerable`1 content, IndexOptions options)
at EPiServer.Find.Cms.ContentIndexer.<>c__DisplayClass19.b__e(IEnumerable`1 currentBatch, ParallelLoopState loopstate)


The first error seems due to a bad link url format (possibly by the editor) but since there's no content id available I don't know how to find this so I can fix it.

The second error I guess is due to json conversion going wrong somewhere, but I'm kind of stumped on this one.

As a result of this no content is indexed.

Any ideas on how to solve this?

Best regards,

Jesper

#143598
Jan 27, 2016 13:17
Vote:
 

Have you tried to analyze the failing JSON being sent using Fiddler?

Tried to clear the index before running the job?

#143636
Edited, Jan 28, 2016 10:05
Vote:
 

Yes, I cleared the index before running the job.

I don't see any requests being made when looking in Fiddler.

I suppose there should be some, as the Epifind index in the cloud actually is updated with the data that's indexed before the errors occur. Strange. Some setting in Fiddler maybe.

#144023
Feb 04, 2016 15:49
Vote:
 

Run link validation job to find any strange links?

#144033
Feb 04, 2016 16:16
Vote:
 

Good idea, will try to run it!

I'll get back with the result.

#144036
Feb 04, 2016 16:30
Vote:
 

Unfortunately, the link validation job didn't find the links that appeared in the error log for the indexing job.

I've tried rolling back to an earlier version of the database and source code, and that fixes the problem.

If I use the latest version of source code and the earlier version of the database (and by that also upgrading the epi database version since we're running on a higher Episerver version in the later version of the source code) the error occurs again.

This leads me to think that either that we introduced some content type or something that could be interpreted as ambigous, or that the way content is converted in the later version of Episerver or Episerver Find is different.

I've tried removing the content types that were added in the later version, but it doesn't make a difference...

#144154
Feb 08, 2016 16:51
Vote:
 

Ok, but that generates a warning so I guess you can live with that one a while. 

For the type exception I'm guessing you are missing a virtual or override on a content type you are using. 

Check out

http://stackoverflow.com/questions/994698/ambiguousmatchexception-type-getproperty-c-sharp-reflection

EPiServer Find is trying to use reflection to find the value of a property to create the search text on a content type but gets multiple answers for it. 

It would be nice to see which one is failing to minimize the search. 

Might want to try disabling index for half your content types (check out conventions with EPiServer Find to do it)...repeat until successful...to find the culprit. This is probably a recent change so checking what content types you have modified the last couple of days might be another way to limit the work. 

#144156
Feb 08, 2016 17:19
Vote:
 

The property will be on a base class...start by checking for search text and see that it's virtual / override...

#144157
Feb 08, 2016 17:21
Vote:
 

Thanks for all the help Daniel!

Using conventions and your idea about faulty property overrides I was at least able to locate one of the culprits.

When hiding a property declared on a base class, instead of using the actual class, an interface was referenced, like so:

[Ignore]
public new IVisibility Visibility
{
    get { return base.Visibility; }
}

Referencing the concrete class and not the interface removed one of the errors.

[Ignore]
public new Visibility Visibility
{
    get { return base.Visibility; }
}

I also discovered that using projections, for example ProjectImageUriFrom(), caused problems when indexing.

I don't know in detail how projections work, but probably because the backstaged database had a lot more content than what would fit in the Epifind developer index (10.000 posts), all the images on the website were not indexed. This then caused an error in the ProjectImageUriFrom() projection when trying to locate them in the Epifind index upon re-indexing.

#144235
Edited, Feb 09, 2016 15:52
Vote:
 

Nice! Not an easy one that one :)

#144236
Feb 09, 2016 16:16
Vote:
 

Hi Guys,

I have the similar issue when trying to run the content indexing job manually. I got an error "ERROR EPiServer.Find.Cms.ContentIndexer:"Server1": An exception occurred while indexing content 1131: Ambiguous match found".

when i tried to access the page with contentdata 1131 inside the CMS,  there is a page and i can see it.But how to identify what is wrong with the page that makes it not to be indexed by the job?

One thing i would like to mention is that this  issue is happening to pages that are under a certain node and that node has been moved around in the pages structure.Also when i tried to create a new page in the node it gets indexed without any issue.It is the existing pages in the node that show this behaviour. I modified the epilError.log file to see detail error for this.Below is a sample

2017-01-23 12:42:04,493 [104] ERROR EPiServer.Find.Cms.ContentIndexer:"Server1": An exception occurred while indexing content 1131: Ambiguous match found.
System.Reflection.AmbiguousMatchException: Ambiguous match found.
   at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
   at System.Type.GetProperty(String name)
   at EPiServer.Find.Cms.ContentExtensions.<GetSearchableProperties>d__10.MoveNext() in xxxxxxxxxxxxxxxxxxxxxxxxxx\DecompilerCache\decompiler\B4F3B20C-CD82-4005-BA69-4BDA281B3CA3\6c\4d65107e\ContentExtensions.cs:line 0
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at EPiServer.Find.Cms.ContentExtensions.SearchText(IContentData contentData) in xxxxxxxxxxxxxxxxxxxxxxx
   at EPiServer.Find.DelegateValueProvider`2.GetValue(Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at EPiServer.Find.Api.BulkActionConverter.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
   at EPiServer.Find.Json.Serializer.SerializeToTextWriter(JsonSerializer serializer, Object value, TextWriter textWriter)
   at EPiServer.Find.Json.Serializer.SerializeObjectsToJsonRequest(JsonSerializer serializer, IJsonRequest jsonRequest, IEnumerable values)
   at EPiServer.Find.Api.BulkCommand.Execute()
   at EPiServer.Find.Cms.ContentIndexer.IndexWithRetry(IContent[] contents, Int32 maxRetries) in xxxxxxxxxxxxxxx\DecompilerCache\decompiler\B4F3B20C-CD82-4005-BA69-4BDA281B3CA3\a8\8ba6e626\ContentIndexer.cs:line 712
   at EPiServer.Find.Cms.ContentIndexer.Index(IEnumerable`1 content, IndexOptions options) in xxxxxxxxxxxxxxx\B4F3B20C-CD82-4005-BA69-4BDA281B3CA3\a8\8ba6e626\ContentIndexer.cs:line 576
   at EPiServer.Find.Cms.ContentIndexer.IndexBatch(IEnumerable`1 content, Action`1 statusAction, Int32& numberOfContentErrors, Int32& indexingCount) in xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\DecompilerCache\decompiler\B4F3B20C-CD82-4005-BA69-4BDA281B3CA3\a8\8ba6e626\ContentIndexer.cs:line 274

thanks for the help

#174267
Jan 23, 2017 19:36
Vote:
 

Dando, did you try to republish the page in question? I've noticed that sometimes when you move pages around the page tree Find doesn't update the url of the page. A republish of the page usually solves this. Also, you can try and republish the parent node as well.

#175900
Edited, Mar 06, 2017 10:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.