Friday, December 14, 2012

Adapting to Lucene.Net with this simplification approach, "Simplifying Lucene using Adapter Pattern, Generics, Reflection, and Custom Attributes"

CodeProject - Simplifying Lucene using Adapter Pattern, Generics, Reflection, and Custom Attributes

I am introducing a draft idea of how we can make Lucene.Net more RAD and also simplifying how .NET developers will interact with Lucene.Net.

The idea is very simple. we need to make the developer code normally in C# Generics. That means the developer just needs to build a list of his document objects List<Student>, for example, and passing this to Lucene.Net to store it using default index and store configuration. Also to search Lucene.Net, either send a free string search query, or build a search object that really represents your criteria to search your document.

By building an Adapter component that will handle the communication between Lucene.Net and C# objects using very simple calls that will allow the result of the idea to come to true using custom attributes to allow us to decorate the Document class properties to explicitly say what type of Index or Store you want this property to be configured in Lucene.Net.

Lucene Cloud Adapter Diagram

Simplifying Lucene using Adapter Pattern, Generics, Reflection, and Custom Attributes

By Haitham Khedre, 14 Dec 2012

0.00 (0 votes)

Introduction

I am introducing a draft idea of how we can make Lucene.Net more RAD and also simplifying how .NET developers will interact with Lucene.Net.

The idea is very simple. we need to make the developer code normally in C# Generics. That means the developer just needs to build a list of his document objects List<Student>, for example, and passing this to Lucene.Net to store it using default index and store configuration. Also to search Lucene.Net, either send a free string search query, or build a search object that really represents your criteria to search your document.

By building an Adapter component that will handle the communication between Lucene.Net and C# objects using very simple calls that will allow the result of the idea to come to true using custom attributes to allow us to decorate the Document class properties to explicitly say what type of Index or Store you want this property to be configured in Lucene.Net.

Lucene Cloud Adapter Diagram

I attached a complete working examples that describe the idea, please feel free to try it and add your comment of how we can extend this.

image

..."

Thought this a pretty unique article and wanted to grab it for future reference and review. And I thought you guys might also find it interesting...

No comments: