caching search results and "saved search"

BP Profile Search caching search results and "saved search"

  • Author
    Post
  • #3381 Reply
    Netsurfaces
    Guest

    Hi Again.

    Have you thought about, or do you have any plans to add caching for the search results, so that perhaps the results of the last search a user ran are stored and displayed automatically when the user goes back to the search page?

    It is also probable that many users run the same broad searches and it would be good that the search results would be cached for a while.

    The way it could work is storing the search terms with the search results and once a search is submitted check if we have a recent result to display without running the search again. I am obviously trying to prevent the same searches to be run over and over. But this is a bit similar to the concept of directories…?

    Another added benefit/feature would be to let users “save their search” with just a checkbox so that the state of the search form is saved and doesn’t expire.

    Are there mechanisms available in to the members/loop to help with the performance, that I should look into instead, or in addition of? 🙂

    #3385 Reply
    andrea
    Plugin Author

    Yes, I’d like to add caching for the search results, but I should also add the logic to invalidate the cache when a member is added/deleted, and when a member’s profile is changed. It’s easier said than done! Otherwise I could invalidate the cache after some elapsed time, but that means giving potentially inaccurate results to your users.

    I think I’ll simply add hooks to allow developers to add caching, and let the cache invalidation decisions to them. Of course if you have better suggestions, they are always welcome.

    By the way, you can let users bookmark their search results if you set the Form Method to GET. That does not mean caching, but could be convenient in some cases.

    And if you prefer to never have the search form cleared, you could remove the else part in bps_set_cookie().

Reply to: caching search results and "saved search"
My Information