Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm tring to create custom index for my database fields. But my code only genarates folders without any index files. Below is the my code please someone help me to figure this out.
My ExmineIndex.config
<?xml version="1.0"?> <ExamineLuceneIndexSets> <!-- Search Custom DB Fields --> <IndexSet SetName="VacationFinderIndexSet" IndexPath="~/App_Data/ExamineIndexes/VacationFinder/"> <IndexUserFields> <add Name="id" /> <add Name="title" /> </IndexUserFields> </IndexSet> </ExamineLuceneIndexSets>
My ExamineSettings.config
<?xml version="1.0"?> <Examine> <ExamineIndexProviders> <providers> <add name="VacationFinderIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine" dataService="SearchIndexProj.VacationFinderDataService, SearchIndexProj" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexTypes="CustomData" indexSet="VacationFinderIndexSet" runAsync="false"/> </providers> </ExamineIndexProviders> <ExamineSearchProviders defaultProvider="ExternalSearcher"> <providers> <!-- Search Custom DB Fields --> <add name="VacationFinderSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="VacationFinderIndexSet" /> </providers> </ExamineSearchProviders>
<add name="VacationFinderIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine" dataService="SearchIndexProj.VacationFinderDataService, SearchIndexProj" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexTypes="CustomData" indexSet="VacationFinderIndexSet" runAsync="false"/> </providers> </ExamineIndexProviders> <ExamineSearchProviders defaultProvider="ExternalSearcher"> <providers> <!-- Search Custom DB Fields --> <add name="VacationFinderSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="VacationFinderIndexSet" /> </providers> </ExamineSearchProviders>
<ExamineSearchProviders defaultProvider="ExternalSearcher"> <providers> <!-- Search Custom DB Fields --> <add name="VacationFinderSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="VacationFinderIndexSet" /> </providers> </ExamineSearchProviders>
<add name="VacationFinderSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="VacationFinderIndexSet" /> </providers> </ExamineSearchProviders>
My VacationFinderDataService.cs(for now I'm assigning dummy data manually.)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Examine.LuceneEngine;
using Examine;
namespace SearchIndexProj
{
public class VacationFinderDataService : ISimpleDataService
public IEnumerable<SimpleDataSet> GetAllData(string indexType)
List<Vacation> _vac = new List<Vacation>();
_vac.Add(new Vacation { Id = 1, Title = "abc" });
_vac.Add(new Vacation { Id = 2, Title = "cde" });
_vac.Add(new Vacation { Id = 3, Title = "asd" });
_vac.Add(new Vacation { Id = 4, Title = "dfg" });
_vac.Add(new Vacation { Id = 5, Title = "fgh" });
_vac.Add(new Vacation { Id = 6, Title = "w4e" });
_vac.Add(new Vacation { Id = 7, Title = "hjk" });
var data = new List<SimpleDataSet>();
foreach (var item in _vac)
data.Add(new SimpleDataSet()
NodeDefinition = new IndexedNode()
NodeId = item.Id,
Type = "CustomData"
},
RowData = new Dictionary<string, string>()
{"id", item.Id.ToString()},
{"title", item.Title}
}
});
return data;
public class Vacation
public int Id { get; set; }
public string Title { get; set; }
Have you checked the umbracoLog table if there's any exception being logged?
Cheers,
Dirk
Yes I have checked. There is no any exception.
found a solution, we need to manually invoke GetAllData method like bellow,
ExamineManager.Instance.IndexProviderCollection["VacationFinderIndexer"].RebuildIndex();
this will create the index files.
Where will you invoke this eshan?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Examine to index search with custom DB fields
I'm tring to create custom index for my database fields. But my code only genarates folders without any index files. Below is the my code please someone help me to figure this out.
My ExmineIndex.config
My ExamineSettings.config
<?xml version="1.0"?> <Examine> <ExamineIndexProviders> <providers>
My VacationFinderDataService.cs(for now I'm assigning dummy data manually.)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Examine.LuceneEngine;
using Examine;
namespace SearchIndexProj
{
public class VacationFinderDataService : ISimpleDataService
{
public IEnumerable<SimpleDataSet> GetAllData(string indexType)
{
List<Vacation> _vac = new List<Vacation>();
_vac.Add(new Vacation { Id = 1, Title = "abc" });
_vac.Add(new Vacation { Id = 2, Title = "cde" });
_vac.Add(new Vacation { Id = 3, Title = "asd" });
_vac.Add(new Vacation { Id = 4, Title = "dfg" });
_vac.Add(new Vacation { Id = 5, Title = "fgh" });
_vac.Add(new Vacation { Id = 6, Title = "w4e" });
_vac.Add(new Vacation { Id = 7, Title = "hjk" });
var data = new List<SimpleDataSet>();
foreach (var item in _vac)
{
data.Add(new SimpleDataSet()
{
NodeDefinition = new IndexedNode()
{
NodeId = item.Id,
Type = "CustomData"
},
RowData = new Dictionary<string, string>()
{
{"id", item.Id.ToString()},
{"title", item.Title}
}
});
}
return data;
}
}
public class Vacation
{
public int Id { get; set; }
public string Title { get; set; }
}
}
Have you checked the umbracoLog table if there's any exception being logged?
Cheers,
Dirk
Yes I have checked. There is no any exception.
found a solution, we need to manually invoke GetAllData method like bellow,
ExamineManager.Instance.IndexProviderCollection["VacationFinderIndexer"].RebuildIndex();
this will create the index files.
Where will you invoke this eshan?
is working on a reply...