I have a website, that content (HTML) is generated using ASP.NET C# from an SQL Server database.
Now I want to add a search function on the website so users can search the content. It would bring up a results page with results.
What is the best way to do this?
The 2 best solutions:
GCS:
Here you will rely totally on Google. If they index your webpage in 60 days, then good luck. You won't find info which isn't stored, publically like a webpage. Therefore, any content within the login, forget it.
You will also rely on Search Engine Optimization. if you don't optimize your page titles, meta descriptions ect, the search won't be of much use.
Custom SQL Server:
If you put a full text index on your data fields, you can search for your keywords. This is a decent solution, but remember the indexes (otherwise it will be very slow).
I would search for "SQL Server Full text search" for help on this solution.
The benefit here is you have full control and you can access everything.
EDIT:
There are of course many other solutions. I would also suggest looking into Lucene, or some implementations on top of Lucene such as Solr. However all search functionality is usually very difficult and timeconsuming, henceforth my first two suggestions.
In the company I work at we've previously used FAST, and use Apptus today.
EDIT 2:
Today I would advice one solution only: ElasticSearch. It's a great solution; easy to work with; works on all platforms; based on a nice REST api and JSON and is performing very well.
Microsoft Index Server: http://www.c-sharpcorner.com/UploadFile/sushil%20saini/UsingIndexServer11262005045132AM/UsingIndexServer.aspx
or ...
Google Custom Search: http://www.google.com/coop/cse/
Your pages are generated from SQL database. I think its safe to assume that the relevant data also lies in the SQL DB rather than the asp templates or the C# code. To search that data you could write multiple queries to the database, based on the contains("search term")
function.
You could have a simple search that executes all those queries and also have advanced search where you can provide checkboxes based on which queries to execute to refine the search.
That would make more sense than doing a raw search over generated content, imo.
Use Lucene (The Apache Lucene project develops open-source search software).
http://lucene.apache.org/
http://ifdefined.com/blog/post/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With