house plans
HAPPY SPRING! We are offering Free Ground Shipping.
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
8326 Views

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
Plans with Indoor Basketball Courts
House Plans
Garage Plans with Shops, Mother In-Law Suites, Apartments and Bonus Square Footage
House Plans
Building a home plan with an indoor basketball court
House Plans
1. Building on slab vs. crawl space vs. basement? Advantages / disadvantage
House Plans
Luxurious Mountain Craftsman House Plans
House Plans
The In-Law Suite Revolution
House Plans
The Finest Duplex, Town House, and Multi Unit Home Plans
House Plans
Florida and California House Plans With a Tuscan Style
House Plans
Beachfront, Coastal and Key West Home Plans
House Plans
Country Porches and Beautiful Farmhouses
House Plans
ARTICLES BY TOPIC
A Home Builders Opinion Air Conditioning Tips Architecture Beachfront Houseplans building lots bungalow Cape Cod House Plans Color Photos Color Schemes Contemporary Style country house plans craftsman house plans Curb Appeal Custom vs Stock House Plans Customer Service Design Do-It-Yourself Door Hardware Door knobs Doorknobs Dream Homes Engineering House Plans european house plans Exterior Materials Extreme Makeover Feng Shui Floorplan Layout Frank Lloyd Wright French Country Home Design Garage Plans Garages green design Home Builders Home Designers Home plans Homebuilding activity homeplans house plan styles house plans House Plans with Photos Housing Market Indoor Gyms in-law suites Jake England Landscaping Log Cabins luxury home plans Luxury House Plans Mediterranean Homeplans
RECENT ARTICLES
Landscape Architecture: Influences and Trends in Whole House Design
House Plans
Thomas Jefferson: The Architect and The Landscape Artist
House Plans
Luxury House Plans from The Plan Collection Featured in Wall Street Journal
House Plans
Great Women in Architecture: Hearst Castle's Julia Morgan
House Plans
TPC Salutes Great Women Architects: Anna Keichline
House Plans
Profiles in Architecture & Design: African American Architects Who Changed Our World
House Plans
The Plan Collection Announces the Best Price Guarantee in the House Plans Industry
House Plans
Architecture and the Presidents: Abraham Lincoln
House Plans
Great 4 bedroom house plan for growing families
House Plans
Developing a Budget to Build Your House Plan
Business
© 2013 The Plan Collection, LLC