Reputation: 14418
I am a noob in ASP.NET and building a website currently... I want the site to have a search feature.. How can I add this to my site? Is there a good tutorial out there ?
Upvotes: 2
Views: 3415
Reputation: 1421
Try this: Asp net with .net LUCENE or this : Also with dotnet lucene
Upvotes: 0
Reputation: 218922
different ways to do it
1 : Dynamic data search within your application- You will have a search page and when user submits a search query, you will build a SELECT query using that and search in apppropriate tables ans show the results from the datasource returned from executing your select query
2 : Static page search - If you have a lot of static pages in your website,you can use this.You need to enable IIS indexing .you have to create a catalog for your site.IIS will do the rest.You need to use the code to read result from IIS index.(The code is not so big.Only few lines.Get it from google)
3 : Add Google search : You can add the google search widget to your website
Upvotes: 0
Reputation: 935
Well, to have a search function you first need something to search in (database, hash table, heap, etc.). I assume that in this case you'll be using a database.
For a basic search function to search for a string in, say, a table of articles you could just use the following SQL statement:
SELECT * FROM `Articles` WHERE `Text` LIKE '%<search string here>%'
The '%' character is the SQL wildcard, so will match the search string wherever it's found: %hell% will match "Hello world" and "shell", etc.
That's a pretty crude way of doing it, so search around for some articles on the subject and you should be able to find some more sophisticated methods.
Upvotes: 3
Reputation: 15041
Why not use Google, of course! This is the website standard for searching. : )
If you mean that you want to search your database and not your website, then usually people do a SQL query with some kind of result display - gridview (fast & easy!), or repeater.
Upvotes: 6