house plans
FREE Shipping on All House Plans!
Home >> Technology >> Article
Search entire site
DREAM. LEARN. DISCOVER... GET STARTED.
Technology
Technology

Search Using ASP.Net and Lucene

Tags : , ,
Published On : 01-01-1753
Author : Steve Donegan
9469 Views
ShareThis

Getting Started

Getting Lucene to work on your asp.net website isn't hard but there are a few tricks that help. We decided to use the Lucene.Net 2.1.0 release because it made updating the Lucene index easier via a new method on the IndexWriter object called UpdateDocument. This method deletes the specified document and then adds the new copy into the index. You can't download the Lucene.net 2.1.0 binary. Instead you will need to download the source via their subversion repository and then compile it.

Don't worry this is an easy step. Using your subversion client - I recommend TortiseSvn get the source by doing a checkout from this url: https://svn.apache.org/repos/asf/incubator/lucene.net/tags/Lucene.Net_2_1_0/

Next go into the directory: Lucene.Net_2_1_0\src\Lucene.Net You should find a Visual Studio solution file that matches your Visual Studio version. If you are using Visual Studio 2005 be sure to load Lucene.Net-2.1.0-VS2005.sln

Hit compile. The resulting Lucene.Net.dll in the bin/release folder is the dll you will need to reference in your Visual Studio project that will contain the Lucene code.

Creating the Lucene Index

Lucene creates a file based index that it uses to quickly return search results. We had to find a way to index all the pages in our system so that Lucene would have a way to search all of our content. In our case this includes all the articles, forum posts and of course house plans on the website. To make this happen we query our database, get back urls to all of our content and then send a webspider out to pull down the content from our site. That content is then parsed and fed to Lucene.

We developed three classes to make this all work. Most of the code is taken from examples or other kind souls who shared code. The first class, GeneralSearch.cs creates the index and provides the mechanism for searching it. The second class, HtmlDocument consists of code taken from Searcharoo a web spidering project written in C#. The HtmlDocument class handles parsing the html for us. Special thanks to Searcharoo for that code. I didn't want to write it. The last class is also borrowed from Searcharoo. It is called HtmlDownloader.cs and its task is to download pages from the site and then create a HtmlDocument from them.

 

References:

COMMENTS
RELATED ARTICLES
User Tips and Info
House Plans
Be Careful With Page.PreviousPage
Technology
The Forums are Broken
Technology
Website Design, Simplify Things.
Business
How to rank high on Google, Yahoo and MSN: Introduction
Business
New Technology Section
Technology
House Plans, Lots of House Plans
House Plans
Apologies in advance
Technology
Thanks for coming
Technology
About a blog
Technology
HOUSE PLANS 101
FAQ
Glossary of Terms
Understanding Blueprints
Understanding Copyright
What's included in a set of house plans?
Why pre-drawn house plans?
MOST POPULAR ARTICLES
1. Building on slab vs. crawl space vs. basement? Advantages / disadvantage
House Plans
Luxurious Mountain Craftsman House Plans
House Plans
The Finest Duplex, Town House, and Multi Unit Home Plans
House Plans
The In-Law Suite Revolution
House Plans
Florida and California House Plans With a Tuscan Style
House Plans
European and Luxury House Plans, Large and Small!
House Plans
Country Porches and Beautiful Farmhouses
House Plans
2x4 or 2x6 construction?
House Plans
Craftsman House Plans from Extreme Makeover: Home Edition
House Plans
Luxury House Plans
House Plans
ARTICLES BY TOPIC
A Frame House Plans A Home Builders Opinion Air Conditioning Tips Architecture Beachfront Houseplans blueprints building lots bungalow Bungalow House Plans Cape Cod House Plans Coastal House Plans Color Photos Color Schemes Contemporary Style country house plans craftsman house plans Curb Appeal Custom vs Stock House Plans Customer Service Design design trends Do-It-Yourself Door Hardware Door knobs Doorknobs Dream Homes Engineering House Plans european house plans Exterior Materials Extreme Makeover Farmhouse House Plans Feng Shui Floor plans Floorplan Layout Frank Lloyd Wright French Country Home Design french house plans Garage Plans Garages green design green house plans Halloween house high performance house plans Home Builders home buying home design Home Design Trends Home Designers Home Designs
RECENT ARTICLES
Trends to Build Home Plans that Embrace Nature and the Environment
House Plans
From Log Cabins to Southfork Ranch and Everything in Between… Variety Spices Texas Style Homes
House Plans
The Great Room: A Throwback to Medieval Times Finds Its Way in the Modern Age
House Plans
“Girl Power” in the 1900s: The First Women Architects Find Success in a Man’s World
House Plans
New Technologies for the Conscious Home Save Energy
Technology
Ready for Your Own Vacation Home? Here Is What to Look For
House Plans
Historical Progression of 3D Printing From Prototypes to 3D House Plans to Robotics
House Plans
What to Look for in an Affordable House Plan: Simplicity, Efficiency and Practicality –With Style!
House Plans
Design Trends in Renovation & House Plans for Home Builders
House Plans
The French House Plan: An Eclectic Mix of the Romantic, Rustic, and Majestic
House Plans
© 2014 The Plan Collection, LLC