I have a large directory of files (mostly PDFs) that I need indexed that sits outside of the media directory. Is there any way to do this? I'm using Cogworks.ExamineFileIndexer to index items in the Media folder, but the issue I have with keeping the files in the media directory through Umbraco is that every time the file is updated, it changes the URL, making management of the documents extremely difficult. So it seems creating a ExamineIndex of these files would be more practical.
public class BookshelfExamineDataService : ISimpleDataService
{
public IEnumerable<SimpleDataSet> GetAllData(string indexType)
{
var data = new List<SimpleDataSet>();
LogHelper.Info<BookshelfExamineDataService>("Building index...");
//this only adds one item to the index, but create a loop and go to town
data.Add(new SimpleDataSet()
{
NodeDefinition = new IndexedNode()
{
NodeId = 1, //a unique identifier
Type = "Bookshelf" //this should match the `type` in the ~/config/ExamineSettings.config
},
RowData = new Dictionary<string, string>()
{
//this is a simple dictionary based on the ~/config/ExamineIndex.config file
//you can customize this however you want but the config should match this dictionary
{"book", "A Book"},
{"path", "/path/to/book"},
{"title", "All about that bass"},
{"text", "The entire page text if you wish."},
{"url", "/url/to/page"}
}
});
return data;
}
}
Indexing Files with Examine in an external directory
I have a large directory of files (mostly PDFs) that I need indexed that sits outside of the media directory. Is there any way to do this? I'm using Cogworks.ExamineFileIndexer to index items in the Media folder, but the issue I have with keeping the files in the media directory through Umbraco is that every time the file is updated, it changes the URL, making management of the documents extremely difficult. So it seems creating a ExamineIndex of these files would be more practical.
Has anyone else done this? Thank you!
The simple way is to create custom Dataservice that inherits from ISimpleDataService
something like this
I found full example - https://github.com/kgiszewski/LearnUmbraco7/blob/master/Chapter%2009%20-%20Searching%20with%20Examine/04%20-%20Custom%20Data%20Sources.md
Thank you! I'm going to try this out and report back! Thanks again!
is working on a reply...