For those looking for a similar answer, the next solution is where I left off. There is no simple mechanism that I could find to interact with a single DAL and perform Lucene indexing.
- Create a gardener module
- Create a new piece of content / type through aMigration
- Using the Orchard Command infrastructure to import data from your secondary database
- Use the OnIndexing event in the Content Part handler so Lucene can index your data source.
- Create a search property (I called my ConcreateProperty) that populates the I service created in the module to interact with the secondary DAL in the OnLoaded event.
My last handler looked like this:
public class HomePartHandler : ContentHandler { public HomePartHandler(IRepository<HomePartRecord> repository, IHomeSearchMLSService homeSearchService) { Filters.Add(StorageFilter.For(repository)); OnLoaded<HomePart>((ctx, part) => { part.ConcreteProperty = homeSearchService.GetByMlsNumber(part.MlsId) ?? new PropertyDetail(); }); OnIndexing<HomePart>((context, homePart) => context.DocumentIndex .Add("home_StreetFullName", homePart.Record.StreetFullName).RemoveTags().Analyze().Store() .Add("home_City", homePart.Record.City).RemoveTags().Analyze().Store() .Add("home_State", homePart.Record.State).RemoveTags().Analyze().Store() .Add("home_Zip", homePart.Record.Zip).RemoveTags().Analyze().Store() .Add("home_Subdivision", homePart.Record.Subdivision).RemoveTags().Analyze().Store() .Add("home_Beds", homePart.Record.Beds).RemoveTags().Analyze().Store() .Add("home_Baths", homePart.Record.Baths).RemoveTags().Analyze().Store() .Add("home_SquareFoot", homePart.Record.SquareFoot).RemoveTags().Analyze().Store() .Add("home_PropertyType", homePart.Record.PropertyType).RemoveTags().Analyze().Store() .Add("home_ListPrice", homePart.Record.ListPrice).RemoveTags().Analyze().Store() .Add("home_MlsId", homePart.Record.MlsId).RemoveTags().Analyze().Store() .Add("home_Latitude", (double)homePart.Record.Latitude).RemoveTags().Analyze().Store() .Add("home_Longitude", (double)homePart.Record.Longitude).RemoveTags().Analyze().Store() ); } }
This allows me to create a search service to search all of my data, and then connect it to the model through the Concrete property, which in any case works better in terms of performance.
Keith source share