Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to add incremental crawling to an External Content Type that we have defined, but I don't want to use the item time-stamp option, which seems to be so prevalent(see: link). I have a .Net Assembly Connector that's calling a 3rd party web service to retrieve changed/retired items. This is why I'd like to do the incremental crawl with the changelog option.

The problem: I've been able to add the ChangedIdsEnumerator and DeletedIdsEnumerator methods to my model and they get called by the search crawler. However, the DateTime parameter that they are expecting isn't getting set properly. It has the value of "12/31/1899 6:00:00PM", which is the default DateTime value of "1/1/1900 12:00:00 AM" translated to my local time (Central Standard Time).

I've tried changing the type of the parameter to a string, but still get null. The full crawl is completing successfully, and this problem is showing up while attempting an incremental crawl. I'm using SharePoint Server Search... not FAST.

Here's a sample of my BDC model:

<Method Name="ReadChangedItems">
  <FilterDescriptors>
    <FilterDescriptor Name="LastCrawl" Type="InputOutput">
      <Properties>
        <Property Name="SynchronizationCookie" Type="System.String">x</Property>
      </Properties>
    </FilterDescriptor>
    <FilterDescriptor Name="Timestamp" Type="Timestamp" />
  </FilterDescriptors>
  <Parameters>
    <Parameter Name="lastCrawlDate" Direction="InOut">
      <TypeDescriptor Name="LastCrawlDate" TypeName="System.DateTime" IsCollection="false" AssociatedFilter="LastCrawl">
        <Interpretation>
          <NormalizeDateTime LobDateTimeMode="Local" />
        </Interpretation>
      </TypeDescriptor>
    </Parameter>
    <Parameter Name="returnIds" Direction="Return">
      <TypeDescriptor Name="ChangedIds" TypeName="System.Collections.Generic.IEnumerable'1[System.String]" IsCollection="true">
        <TypeDescriptors>
          <TypeDescriptor Name="Id" TypeName="System.String" IdentifierName="id"/>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
  </Parameters>
  <MethodInstances>
    <MethodInstance Name="ReadChangedItemsInstance" Type="ChangedIdEnumerator" ReturnParameterName="returnIds"  />
  </MethodInstances>
</Method>

Here's a screenshot from my debugging session when the method has been called: enter image description here

The primary resource which I've been using to try to get this working is this book called "Professional Business Connectivity Services in SharePoint 2010". I've also saved various links that have seemed to be useful into a bit.ly bundle (see: link).

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You have to set the timestamp in your ChangedIdEnumerator-method.

It should be something like this:

IEnumerable<string> ReadChangedItems(ref DateTime lastCrawlDate)
{
     .....

     lastCrawlDate = DateTime.Now;

     return ...;
}
share|improve this answer
    
That sounds promising. I'm not sure when I'll get to try this out myself, but I'll mark this as the answer whenever I'm able to confirm it. –  atcrawford Jun 12 '13 at 16:23
    
Just confirmed that the date parameter does work by doing this. Thanks so much for sharing that answer! –  atcrawford Jun 24 '13 at 20:52
add comment

I haven't been able to figure out the proper way to do this, so it seems the best backup option is to persist the last crawled DateTime in my own data-store instead of relying on SharePoint to provide that value. Not ideal, but should do the trick.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.