Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michael Lawrence 128 posts 200 karma points
    Mar 28, 2012 @ 18:31
    Michael Lawrence
    0

    Examine not rebuilding indexes when programmatically creating Members

    I'm having an issue with Examine not rebuilding the indexes when I programmatically create a Member. Here's my code for creating a Member:

     

    User author = User.GetUser(0);
    MemberType mt = MemberType.GetByAlias(Constants.MEMTYPE_APPLICATIONUSER);
    Member m = Member.MakeNew(name, mt, author);
    m.Password = pass;
    
    

    HttpRequest post = HttpContext.Current.Request;

    string profileData = post["profileData"]; if (!String.IsNullOrWhiteSpace(profileData)) { m.getProperty(Constants.PROP_PROFILEDATA).Value = profileData; } m.LoginName = login; m.Save(); ExamineManager.Instance.IndexProviderCollection[Constants.EXAMINE_MEMBERSEARCHER].RebuildIndex();

     

    I've tried this with and without calling the RebuildIndex method on the IndexProvider, but neither works. What happens is that the index is updated with the new member, but the profileData property is blank in the index, even though it does contain data. I am indexing profileData in the index set also.  Here's my index set:

    <IndexSet SetName="PointClickMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/PointClickMemberIndexSet/">
        <IndexAttributeFields>
          <add Name="id" EnableSorting="true" />
          <add Name="createDate" EnableSorting="true" />
          <add Name="nodeName" EnableSorting="true"/>
          <add Name="loginName" EnableSorting="true" />
        </IndexAttributeFields>
        
        <IndexUserFields>
          <add Name="serialNumber" EnableSorting="true" />
          <add Name="groupID" EnableSorting="true" />
          <add Name="externalID" />
          <add Name="profileData" />
        </IndexUserFields>
        
        <IncludeNodeTypes>
          <add Name="ApplicationUser"/>
        </IncludeNodeTypes>
        
        <ExcludeNodeTypes />
      </IndexSet>

     

    Any idea of what's going on?

  • Lee 1130 posts 3088 karma points
    Jun 29, 2012 @ 09:00
    Lee
    0

    I have the exact same problem? I'm using 4.7.1 and doing pretty much exactly the same as you, I have tried to avoid the rebuild call but without it the member Id, email and username gets saved. BUT all properties are blank until I rebuild the index??

  • jaygreasley 416 posts 403 karma points
    Jun 29, 2012 @ 11:12
    jaygreasley
    0

    call me crazy but don't you have to rebuild the index (or it rebuilds on schedule) for new data to be in it? 

    (I'm not exactly sure how Examine works but with lucene and solr you have to run imports etc).

     

  • Lee 1130 posts 3088 karma points
    Jun 29, 2012 @ 11:21
    Lee
    0

    I didn't think it rebuilt the entire index, as if you have a really busy site (Which I do) with 1000's of members and lots of new signups - Isn't it just going to be always rebuilding? Also currently, rebuild with around 6K members takes around 60+ seconds.

    Just like some clarification, if this is fine then I'll continue just calling the 

    .RebuildIndex()

    method everytime a new member signs up

  • jaygreasley 416 posts 403 karma points
    Jun 29, 2012 @ 11:28
    jaygreasley
    0

    there's an interval setting in the examine config - http://examine.codeplex.com/wikipage?title=Full%20Configuration%20Markup%20%26%20Options&referringTitle=UmbracoExamine

    I *assume* this is how often that particular indexer runs automatically. Maybe Shannon can clarify though.

    It may do a delta import as well, as you say reindexing everything would be quite a load.

    /j

  • Lee 1130 posts 3088 karma points
    Jul 01, 2012 @ 09:40
    Lee
    0

    Seems you can't call the .RebuildIndex() on member creation, as if you have 1000's of members it just hangs until its finished! The interval setting is set to 10 but it doesn't seem to be paying any attention to that.

    It is sort of working, as its as its indexing the members and standard attributes/properties (Username, email, createDate etc..) but its just ignoring custom properties until I manually rebuild the index?

    Any help/pointers would be appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft