I’m looking for some advice. I recently wrapped up a project where I inherited some terrible code. I got the application running but it’s safe to say there are a number of performance and design issues, specifically with the advanced search functionality. I have now been asked to do a very similar project but much larger in scale. I have an opportunity here to build a much better domain model from scratch and create a much better application as a whole. The question is what would be the best way to implement the advanced search?
The advanced search page brings up a form with two required text fields, 4 optional dropdown lists, and two separate areas with multiple optional checkboxes to filter the results even further.
The current solution uses the two required fields to return a List of objects that I then filter and eliminate based on any optional form values. I then throw the filtered List into the cache and attach the user’s session id. Then on each results page, I have an Html.Helper that displays paging links that use the Take().Skip() approach on the List retrieved from the cache to display 10 results.
The issue I’m having is that the list can get pretty beefy. I’m trying to save database calls for every new page of results by putting it in the cache but I’m not sure if that’s the best way to approach this. Should I just put all the form values in a monster query string and keep making database calls from the GET requests? Should I save the users search criteria in a database or session and use those for every new page of results? Am I right with using the cache to hold such a beefy collection?
I asked a question similar to this here: http://stackoverflow.com/questions/1663616/paging-search-results-with-asp-net-mvc that led me to using the cache. Now that I have a clean slate I would love to follow best practices and do it right from the start. Any suggestions would be great.