house plans
FLASH Sale on ALL Plan Packages: 10% Off at Checkout. Use Promo Code: NOW14 - Free Shipping Too! Only Thru 9/30.
Question or to order
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
9829 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

Search House Plans

Bedrooms
 1  2  3  4  5+
Bathrooms
 1  1½  2  2½  3  3½  4+
Stories Garage Bays
 1  1½  2  1  2  3+
Square Feet
to
View Results
Enter Plan #:
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
Plans with Indoor Basketball Courts
House Plans
1. Building on slab vs. crawl space vs. basement? Advantages / disadvantage
House Plans
Building a home plan with an indoor basketball court
House Plans
Garage Plans with Shops, Mother In-Law Suites, Apartments and Bonus Square Footage
House Plans
Luxurious Mountain Craftsman House Plans
House Plans
XML Encoding Problems - Hexadecimal Value 0x1A, is an Invalid Character
Technology
Beachfront, Coastal and Key West Home Plans
House Plans
The Finest Duplex, Town House, and Multi Unit Home Plans
House Plans
European and Luxury House Plans, Large and Small!
House Plans
The In-Law Suite Revolution
House Plans
ARTICLES BY TOPIC
A Frame House Plans A Home Builders Opinion Air Conditioning Tips Architecture beachfront house plans Beachfront Houseplans blueprints building log building lots building mistakes bungalow Bungalow House Plans Cape Cod House Plans celebrity home designs Coastal House Plans Color Photos Color Schemes Considerations for Building Foundations in a New House Plan Contemporary Style country house plans craftsman house plans Curb Appeal Custom vs Stock House Plans Customer Service
RECENT ARTICLES
The One-Story Home: Stylish Living Without Stairs
House Plans
Do You Really Want an Environmentally Conscious Home?
House Plans 101
Home Building Costs that Might Sneak up on You
House Plans 101
Is Tiny Living For You? The Tiny House: A Look at a Minimalist Style
House Plans
Best House Plans: Traffic Patterns, Doors and Windows
House Plans 101
Mold Growth from Poor Construction on your Modern House Plan
House Plans 101
Classic Georgian Colonial House Plan for Growing Families
House Plans
Installing the Proper Insulation
House Plans 101
Considerations for Building Foundations in a New House Plan
House Plans 101
Award-Winning TV Celebrity Home Designs
House Plans
© 2014 The Plan Collection, LLC