Hi all,
I'm using a custom BCS .Net Assembly connector with my BDC model but can't seem to get the Incremental Crawl working correctly. It keeps doing a Full crawl, or at least it seems that way because the crawl log keeps givingSuccesses instead of Not Modified's. Also, my Stream Accessor method is called for each item, even though the item wasn't modified.
In my model, I've got 3 methods on my ECT:
- A Finder method (this is my RootFinder, LastModifiedTimeStampField is set to the ModificationDate property of my ECT)
- A SpecificFinder method (just to be sure, this also has the LastModifiedTimeStampField set to the ModificationDate property of my ECT)
- A StreamAccessor method that provides the binary-stream of my item (for instance, a Word document, an HTML file, etc)
I want to use the timestamp-approach instead of the changelog-approach. This should be the easier way, but unfortunately I can't get it to work...
In my code, I write a message to the ULS everytime my FINDER, SPECIFICFINDER or STREAMACCESSOR is called. No matter what ModificationDate I use on my ECT in the FINDER call, it keeps on calling the SPECIFICFINDER and STREAMACCESSOR on each item.
By the way, my Full crawl works as expected.
My (simplified) BDC-model:
<Entity Name="SomeSystemContentItem" Namespace="PoC_SomeSystemBDC.SomeSystemContentBdcModel" EstimatedInstanceCount="1000" Version="1.0.0.76"><Properties><Property Name="Class" Type="System.String">PoC_SomeSystemBDC.SomeSystemContentBdcModel.SomeSystemContentItemService, SomeSystemContentBdcModel</Property></Properties><Identifiers><Identifier Name="ItemURL" TypeName="System.String" /><!-- TODO: Change the name of the ID and if needed the TypeName of your identifier. --></Identifiers><Methods><Method Name="ReadItem"><Parameters><Parameter Name="SomeSystemContentItem" Direction="Return"><TypeDescriptor Name="SomeSystemContentItem" TypeName="PoC_SomeSystemBDC.SomeSystemContentBdcModel.SomeSystemContentItem, SomeSystemContentBdcModel" IsCollection="false"><TypeDescriptors><TypeDescriptor Name="ItemURL" TypeName="System.String" IdentifierName="ItemURL" ReadOnly="true" /><TypeDescriptor Name="ModificationDate" TypeName="System.DateTime" IsCollection="false" /></TypeDescriptors></TypeDescriptor></Parameter><Parameter Name="itemURL" Direction="In"><TypeDescriptor Name="ItemURL" TypeName="System.String" IdentifierEntityName="SomeSystemContentItem" IdentifierEntityNamespace="PoC_SomeSystemBDC.SomeSystemContentBdcModel" IdentifierName="ItemURL" /></Parameter></Parameters><MethodInstances><MethodInstance Name="ReadItem" Type="SpecificFinder" ReturnParameterName="SomeSystemContentItem" ReturnTypeDescriptorPath="SomeSystemContentItem"><Properties><Property Name="LastModifiedTimeStampField" Type="System.String">ModificationDate</Property></Properties></MethodInstance></MethodInstances></Method><Method Name="ReadList"><Parameters><Parameter Name="SomeSystemContentItemList" Direction="Return"><TypeDescriptor Name="SomeSystemContentItemList" TypeName="System.Collections.Generic.IEnumerable`1[[PoC_SomeSystemBDC.SomeSystemContentBdcModel.SomeSystemContentItem, SomeSystemContentBdcModel]]" IsCollection="true"><TypeDescriptors><TypeDescriptor Name="SomeSystemContentItem" IsCollection="false" TypeName="PoC_SomeSystemBDC.SomeSystemContentBdcModel.SomeSystemContentItem, SomeSystemContentBdcModel"><TypeDescriptors><TypeDescriptor Name="ItemURL" IdentifierName="ItemURL" ReadOnly="true" TypeName="System.String" /><TypeDescriptor Name="FileName" TypeName="System.String" /><TypeDescriptor Name="ModificationDate" TypeName="System.DateTime" IsCollection="false" /></TypeDescriptors></TypeDescriptor></TypeDescriptors></TypeDescriptor></Parameter></Parameters><MethodInstances><MethodInstance Name="ReadList" Type="Finder" ReturnParameterName="SomeSystemContentItemList" ReturnTypeDescriptorPath="SomeSystemContentItemList"><Properties><Property Name="RootFinder" Type="System.String">x</Property><Property Name="DisplayUriField" Type="System.String">ItemURL</Property><Property Name="LastModifiedTimeStampField" Type="System.String">ModificationDate</Property></Properties></MethodInstance></MethodInstances></Method><Method Name="ReadItemStream"><Parameters><Parameter Name="itemURL" Direction="In"><TypeDescriptor Name="ItemURL" TypeName="System.String" IdentifierName="ItemURL" /></Parameter><Parameter Name="StreamData" Direction="Return"><TypeDescriptor Name="StreamDataTypeDescriptor" TypeName="System.IO.Stream" /></Parameter></Parameters><MethodInstances><MethodInstance Name="ReadItemStreamInstance" Type="StreamAccessor" ReturnParameterName="StreamData" ReturnTypeDescriptorPath="StreamDataTypeDescriptor" /></MethodInstances></Method></Methods></Entity>
My code for the three methods:
public SomeSystemContentItem ReadItem(string id) { SomeSystemContentItem entity = new SomeSystemContentItem(); entity.ItemURL = id; entity.ModificationDate = DateTime.Now.AddDays(-5); return entity; } public IEnumerable<SomeSystemContentItem> ReadList() { string address = "http://url-to-some-index-xml-file"; XPathDocument doc = new XPathDocument(address); XPathNavigator navigator = doc.CreateNavigator(); XPathNodeIterator nodes = navigator.Select("/rdf:RDF/rss:channel/rss:item/rss:link", ns); List<SomeSystemContentItem> items = new List<SomeSystemContentItem>(); int count = 0; int maxItems = 10; while (nodes.MoveNext() && count < maxItems) { XPathNavigator node = nodes.Current; items.Add(new SomeSystemContentItem { ItemURL = node.Value, ModificationDate = DateTime.Now.AddDays(-3) }); count++; } return items; } public Stream ReadItemStream(string itemURL) { HttpWebRequest request = WebRequest.Create(itemURL) as HttpWebRequest; HttpWebResponse response = request.GetResponse() as HttpWebResponse; return response.GetResponseStream(); }
I hope someone can explain to me why the Incremental crawl isn't working...