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>
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; }
}
}
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/35904-examine-to-index-search-with-custom-db-fields