Copied to clipboard

Flag this post as spam?

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


  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Nov 28, 2014 @ 14:13
    Morten Bock
    0

    ISimpleDataService not indexing data

    I'm trying to create a Lucene index to index some custom data.

    I can successfully create the index files, and each of my records get a document in the index, but the docuemnts only contain the NodeId and Type from the IndexedNode, but none of the data in the RowData property are being stored, according to the Luke tool.

    Following is my code and the config:

    Data Service:

    public class ProductIndexDataService : ISimpleDataService
    {
        public IEnumerable<SimpleDataSet> GetAllData(string indexType)
        {
            var set = new List<SimpleDataSet>();
            set.Add(createSet(1, indexType));
            set.Add(createSet(2, indexType));
            set.Add(createSet(3, indexType));
            return set;
        }
    
        private SimpleDataSet createSet(int index, string indexType)
        {
            var simpleDataSet = new SimpleDataSet();
            simpleDataSet.NodeDefinition = new IndexedNode();
            simpleDataSet.NodeDefinition.NodeId = index;
            simpleDataSet.NodeDefinition.Type = "CustomData";
    
            simpleDataSet.RowData = new Dictionary<string, string>();
            simpleDataSet.RowData.Add("Name", "Some name " + index);
            simpleDataSet.RowData.Add("Description", "Some desc " + index);
    
            return simpleDataSet;
        }
    }
    
    IndexSet config
      <IndexSet SetName="ProductIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Products/">
        <IndexAttributeFields>
          <add Name="Name" />
          <add Name="Description"/>
        </IndexAttributeFields>
      </IndexSet>
    
    Indexer
     <add name="ProductIndexer"
                type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
                dataService="Vertica.Trollbeads.XSite.Domain.Services.ProductIndexDataService, Vertica.Trollbeads.XSite"
                analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
                indexTypes="CustomData"
                indexSet="ProductIndexSet"
                runAsync="false"/>

    Searcher

    <add name="ProductSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine"           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
               indexSet="ProductIndexSet"/>

    Code for rebuilding the index:

    ExamineManager.Instance.IndexProviderCollection["ProductIndexer"].RebuildIndex();

    I can't figure out what I am missing to get the RowData into my index?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Nov 28, 2014 @ 14:16
    Morten Bock
    0

    Sidenote. The Umbraco version is 6.2.4

  • Tim Anderson 20 posts 83 karma points
    Nov 28, 2014 @ 14:38
    Tim Anderson
    100

    Hi Morten,

    Try changing the index configuration to the following....

    <IndexSet SetName="ProductIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Products/">
        <IndexUserFields>
            <add Name="Name" />
            <add Name="Description"/>
        </IndexUserFields>
    </IndexSet>
    

    This is the only major difference I can see in our current 6.2.2 build using ISimpleDataService's and ours are working quite nicely.

    Don't forget to rebuild your index after making the configuration change!

    Kind regards,

    Tim

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Nov 28, 2014 @ 14:39
    Ismail Mayat
    0

    Morten,

    Are you able to attach debugger and see if it its hitting that code? Do you get an index albeit empty one? One more thing trying setting runAsync to true as i have db indexer that works and thats the only difference i can between mine and yours.


    Regards

    Ismail

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Nov 28, 2014 @ 14:45
    Morten Bock
    0

    Tim, you were right on the money. I was using the wrong config field. Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft