Faceted Search - A solution

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Not to long ago, I was required to develop a faceted search system that could be used in various projects. I looked and looked but only found "Design Patterns for Faceted Searches" or "Faceted Search Best Practices" (which focused on user interface). I wasnt able to actually find a good solution. After thinking about it and thinking about it, I came up with a solution that worked based on the requirements I was given.
BTW: If you dont know what faceted search is, check out NewEgg.com or Amazon.com. Their Navigation is a faceted search system. http://en.wikipedia.org/wiki/Faceted_search http://en.wikipedia.org/wiki/Faceted_search
Requirements:
<ol>
Facets are unknown ahead of time.
Facet "categories" will be known (based on project).
Facets could change at any time.
Data could come from anywhere in any format.<br/>-Data must be filtered by selected facets<br/>-Available facets must be extracted and returned to the client
</ol>
What I came up with was to use XML serialization and Linq to XML to perform the required actions.
<ol>
User logs in
User is presented with default search
User enters search criteria and submits (Search term and facets if available)
System receives request<br/>a. Search is performed on search term<br/>b. Search results are returned and sent to the Facet Filter where the data is serialized into XML. Linq to XML pulls out only the nodes that fit the criteria.Remaining Nodes are deserialized and returned.<br/>c. Filtered data is sent to Facet Extraction where the data is again serialized into XML. Linq to XML performs work to extract the Categories and all unique values under each Category. Extracted facet data is returned.<br/>d. Filtered results and Facet options are returned to client
Client receives data, displays results and builds facet filtering menu
</ol>
This is a pretty simple process. The code that ive written does pretty much what ive described here.
Known limitations of existing system:
<ol>
Constraint facets. Ex: Filter by Age where Age is between 21 and 31. This can easily be resolved.
Refinement. This system (because of its universal approach) does not allow for refinements. Ex: Search for records where State is CA then (at the same time) allow user to select facet for City (only showing cities in selected state CA) then (at the same time) allow user to select specific zip codes under the selected city. After each facet selection, there must be a postback to retrieve the remaining facet values. If this were not a universal/dynamic solution then I could have put in preconfigured options to extract the remaining facets in a way that would allow refinements to be possible. But, this would require knowing about the data before hand. My requirements were that I wont know what data is coming through.
</ol>
If you would like to see the solution (C# VS 2008 .Net 3.5) please send me an email. I dont have anywhere to host it at the moment but I should sometime this weekend.
I would like your opinion on the system and any notes on how it could be improved. However, keep in mind that I realize this system would not scale very well. This was a proof of concept. In my real project weve utilized XQuery inside of stored procs to query data by search term and then filter by facets (all db server level). Facet extraction is done in the business layer still however and any further post-processing as well (plugins).
Im providing this in hopes that someone can find it useful and not have to bang their head for several days trying to figure out a faceted search system.

<
<a title="Free tech books http://www.101ftb.com/T50A30J010 Get FREE tech books (Development and IT) <br/><a title=Programmers-Unlimited.com href="http://www.Programmers-Unlimited.com Programmers-Unlimited.com

View the full article
 
Back
Top