When developing web-based forms using the ASP.NET platform, one of the basic tools that is lacking from the framework is an effective search mechanism. Custom queries seem to have been neglected due to their apparent complexity, and their non-geometric fit into the ideology of most frameworks. Still, a good search tool is very useful to users for finding relevant data in a large database. As such, we have developed a few tools and methodologies to make search implementation easier in web applications.
There are three primary levels of search in web applications. At the most general, a holistic, single field query can often be an easy and effective way to search a table. In fact, this has proven to work well for even the largest databases, as evidenced by Google’s search index. Only one text field is used to search the entire Internet, and most users are more than satisfied with its performance. For simple tables, the solution is to add one additional “query” field to the application server, and perform a wildcard search against all columns with its content. More advanced versions of the single-field query can sort results by relevance, offer weighted search results based on important characteristics, and customize display results based on the query.
The next level of database search allows queries by individual columns. This is similar to the single-field, except that additional fields can be added, and a drop-down in front of each query allows the user to narrow the search to a column. This can be useful for searching table data with many columns for a particular record, when the use-case can change over time, or the importance of the columns changes for each user.
Finally, a full logic-based search per column is the most advanced query method. This allows the user to select the column from a drop-down list, and then select the comparison method, whether it is “less than”, “equal to”, “greater than”, “contains”, or one of the other logic-based searches. This allows searching for numerical and date values between a range, which can be very useful in certain applications. Of course, this also carries the greatest programming overhead, and if the need for these queries is sparse, an Excel or CSV export is often a more effective way of implementing this capability.
An effective search can significantly improve user productivity. By utilizing one of these techniques, either the single search, column search, or full logic-based column search, ASP.NET web applications can harness the full power of a relational database.
Written by Andrew Palczewski
About the Author
Andrew Palczewski is CEO of apHarmony, a Chicago software development company. He holds a Master's degree in Computer Engineering from the University of Illinois at Urbana-Champaign and has over ten years' experience in managing development of software projects.