Topic
6 replies Latest Post - ‏2013-04-26T16:13:52Z by Alessandro.Damiani
SystemAdmin
SystemAdmin
445 Posts
ACCEPTED ANSWER

Pinned topic [ICN 2.0.1] - How to clear recent searches list?

‏2013-03-07T16:02:39Z |
Hello,
I have ICN 2.0.1 set up with IBM Content Manager 8.4.02.

I need to find the correct way to clear the "Recent Searches" list, because I have run into an error that is quite annoying on the end-user side, and which I will briefly describe:

  • A search was created and saved by user A, and access to it was given also to user B
  • User B performed the search, which thus was included in his "recent searches" list
  • User A deleted the search, and it correctly disappeared from both the "All Searches" and "Recent Searches" lists for user A
  • User B gets an error every time he opens up ICN, stating that his search present in the "Recent Searches" list does not exist anymore, but there is no way to remove it from that list (the search does not appear in the "All Searches" list for user B anymore)

I have been able to locate the items representing the "live" searches within Content Manager, but I haven't been able to find where ICN stores the data to populate the "Recent Searches" list.

Thanks for your help!

Alessandro Damiani
Updated on 2013-03-21T13:58:21Z at 2013-03-21T13:58:21Z by SystemAdmin
  • damorris
    damorris
    760 Posts
    ACCEPTED ANSWER

    Re: [ICN 2.0.1] - How to clear recent searches list?

    ‏2013-03-07T20:56:42Z  in response to SystemAdmin
    That is an interesting problem. I'll put an enhancement in our backlog to add an option to clear the list. I'll also see if we can make the app more intelligent so it removes a recent search if it's no longer valid.

    In the meantime, you could probably solve the issue with a plugin that would add a clear option.
    • SystemAdmin
      SystemAdmin
      445 Posts
      ACCEPTED ANSWER

      Re: [ICN 2.0.1] - How to clear recent searches list?

      ‏2013-03-18T09:55:42Z  in response to damorris
      Thank you Dana,
      I have tried the plugin option, by coding an Action plugin triggered by a button on the global Toolbar.

      The action code, extremely simple since the repository object inherits from ecm.model._RecentSearchesMixin, which has a clearRecentSearches() method, is as follows:

      
      function clearRecentSearchesPluginAction(repository, items) 
      { alert(
      "Action invoked!"); repository.clearRecentSearches(); alert(
      "Done."); 
      }
      


      The two alerts are there only for letting me know that the plugin has been invoked, and they show correctly.
      The "Recent Searches" list, however, does not get cleared, despite the fact that the call to the clearRecentSearches() method does not produce any error...
      • bemorris
        bemorris
        123 Posts
        ACCEPTED ANSWER

        Re: [ICN 2.0.1] - How to clear recent searches list?

        ‏2013-03-18T10:32:45Z  in response to SystemAdmin
        The clearRecentSearches method only clears the cache. To remove recent searches you should use the following method:

        /**
        * Asynchronously removes the specified search templates from the list of recent searches.
        *
        * @param searches
        * The {@link ecm.model.SearchTemplate} objects to be removed from the list of recent searches
        * @param callback
        * An optional function called with the updated list of recent searches after the search is removed
        */
        removeRecentSearches: function(searches, callback)
        • SystemAdmin
          SystemAdmin
          445 Posts
          ACCEPTED ANSWER

          Re: [ICN 2.0.1] - How to clear recent searches list?

          ‏2013-03-21T13:58:21Z  in response to bemorris
          Thank you, this definitely works!
        • CBS3_Ian_Wilson
          CBS3_Ian_Wilson
          41 Posts
          ACCEPTED ANSWER

          Re: [ICN 2.0.1] - How to clear recent searches list?

          ‏2013-04-24T16:52:10Z  in response to bemorris

          So, to call the method removeRecentSearches, you need to pass in a parameter of a search template?  And presumably, you can pass in the items parameter if calling this from a PluginAction?

          Would the following piece of code work?

          function clearRecentSearches(repository, items)

          {

            repository.removeRecentSearches(items);

            alert("The Recent Search has been cleared");

          }

          Updated on 2013-04-24T16:52:34Z at 2013-04-24T16:52:34Z by CBS3_Ian_Wilson
          • Alessandro.Damiani
            Alessandro.Damiani
            58 Posts
            ACCEPTED ANSWER

            Re: [ICN 2.0.1] - How to clear recent searches list?

            ‏2013-04-26T16:13:52Z  in response to CBS3_Ian_Wilson

            I don't know about passing "items" to the removeRecentSearches call... What I did was this:

            function clearRecentSearchesPluginAction(repository, items) {

                repository.removeRecentSearches(repository._recentSearches);
                repository.refresh();
                
            }

            and this works...