View Full Version : question about search boxes on an asp.net designed website

code beginner
02-21-2011, 09:41 PM

It it possible to design a "general purpose" search box on an asp.net powered website?

For example, on this website (codingforums.com) you can type whatever words you want into the search box. If you type in "flash animations using graphics", the search engine on this site will scan through all of the stuff in the database, and then return a whole bunch of search results pages that have all or some of the words in "flash animations using graphics".

How do you do this with an asp.net site?

I've been looking through books in the store. NONE of them tell you how to make an all-purpose "search the entire database" search box. Instead, they all keep telling you to set up a hand-coded table with a primary key, then set up something with a foreign key. Then enter the hypothetical "employees names". Then enter what "department" they theoretically work for. Then enter the "office number" they work in.

The whole thing they are trying to communicate strikes me as being someone trying to set up human resources files and things like medical records.

What I want is a completely FREE FORM (sorry for the shouting) search box. I don't want to have to create a multi-dimensional array table and painstakingly enter information each time I set up a new web page on a site, or add content to an existing page on a site.

I want the database and search engine machinery to automatically behind-the-scenes gather this stuff into one giant all-purpose database. Then if someone types "green lettuce grown in Argentina", the asp.net/SQL search technology will look for those words in the entire database, and return a whole big set of webpages as search results that contain all or maybe some of the words: green, lettuce, grown, in, Argentina.

Do you see what I'm getting at?

What is "this" called in asp.net? What books have this?

I'm trying to find a good 70 pages or so on this topic. I'm hitting dead ends, and I don't even know what vocabulary to use to accurately describe what I'm trying to learn.

I find it stunning that I open book after book and can't find this information. Maybe it's hiding in plain sight and I don't even know how to see it. The best I can come up with is that people are hinting at something called "full text search". But I don't know if I have the perceptual capability of databases and the vocabulary of databases yet to piece together my own instruction map of this stuff from bits and pieces of pages on the internet.

I'm looking for some sort of book or training manual I can spend a lot of time with going through line-by-line, page-by-page. Then when I'm at the end, I completely know how to set up an asp.net site to have an "all purpose, catch-all" search box.

If I just try to scrape this stuff together from disparate, fragmented sources on the web, I don't think I'll get there very well.

Thanks for any ideas on pointing me in the right direction with this stuff.

02-23-2011, 07:52 PM
Keep in mind how a forum works. There are threads and then there are posts within each thread. Each thread is really just a post that's record ID is the thread ID of any containing posts, so (most likely) all threads and post are housed in a single table. Each row in said table has a corresponding category ID which is linked to a different table keeping track of category names. So doing a "complete search" of the site, isn't that complicated of a SQL query.

As far as I know there is no magical behind the scenes thing you can do to query your entire database. You'll need to create a query that joins all relevant tables and specifies the column names to search through. Depending on the complexity of your database, this can be very simple or quite the undertaking. Without seeing your data model there's not really any more advice I can give.