Custom Examine DataService, auto indexing

Hello there :slight_smile:

Perhaps you can help me?

I’ve created a custom:

ISimpleDataService

    public class AddressDataService : ISimpleDataService
    {
        public IEnumerable<SimpleDataSet> GetAllData(string indexType)
        {
            var watch = new Stopwatch();
            watch.Start();

            var dataSetList = new List<SimpleDataSet>();

            var workplaces = Builder<Address>
                .CreateListOfSize(14000)
                .Random(3)
                .With(x=>x.MemberNumber = 1)
                .Build();

            foreach (Address workplace in workplaces)
            {
                var rowData = new Dictionary<string, string> {
                    { "Id", workplace.Id.ToString() },
                    { "Name", workplace.Name },
                    { "Street", workplace.Street },
                    { "ZipCode", workplace.ZipCode.ToString() },
                    { "City", workplace.City },
                    { "PhoneNumber", workplace.PhoneNumber },
                    { "CellPhoneNumber", workplace.CellPhoneNumber },
                    { "Email", workplace.Email }
                };

                var dataSet = new SimpleDataSet
                {
                    NodeDefinition = new Examine.IndexedNode
                    {
                        NodeId = workplace.Id,
                        Type = "Workplace"
                    },
                    RowData = rowData
                };

                dataSetList.Add(dataSet);
            }
            watch.Stop();
            LogHelper.Info<AddressDataService>("{0} addresses was indexed in {1} ms. ", () => workplaces.Count(), () => watch.Elapsed.Milliseconds);

            return dataSetList;
        }
    }

And added it to:
ExamineIndex.config:

<IndexSet SetName="AddressIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/AddressIndex/">
    <IndexUserFields>
      <add Name="Id" />
      <add Name="Name" />
      <add Name="Street" />
      <add Name="ZipCode" />
      <add Name="City" />
      <add Name="PhoneNumber" />
      <add Name="CellPhoneNumber" />
      <add Name="Email" />
    </IndexUserFields>
  </IndexSet> 

And to:
ExamineSettings.config

 <add name="AddressIndexer" 
        type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
        dataService="ProjectName.Web.DataService.AddressDataService, Fodterapeuter.Web"
        indexTypes="Workplace"
        indexSet="AddressIndexSet"
        runAsync="false"
        enableDefaultEventHandler="false"/>

Now here is the real problem:
Rebuilds every time i restart AppPool
I dont wan’t that, because i’m indexing 14000 addresses each time.

is there a way to stop it from indexing on application start?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/72815-custom-examine-dataservice-auto-indexing