Comment 1 for bug 1989813

Revision history for this message
Charles Haley (cbhaley) wrote :

@kovid: FWIW: I can't think of a straight forward way to do this. It isn't hard to produce a list of (category, value) pairs from the filtered tag browser. This can be converted to a set of book ids. However, getting that set into the search mechanism is a mystery. Building a search string is out because the set can contain may thousands of ids. Building a search string from the pairs is possible and would probably produce a reasonably-sized search string, but performance will truly be terrible.

One approach I have thought of that is performant would be to create a new search term, for example 'in_tag_browser'. The tag browser would pass the set of filtered book ids to db.cache. A search like "in_tag_browser:true" would check that the book id is in the current filtered set.

Another option is to filter in view.py.refresh(), ensuring that _map_filtered is restricted to ids in the list. In this case the tag browser would pass the list to view (db.data.set_tag_browser_books() or some such). Using this method the restriction would be recomputed on every tag_browser.refresh() and would be used whenever the GUI does a refresh. I prefer this approach because a) it doesn't change the name space, and b) operates only on the GUI booklist / cover browser.

Neither of these approaches answers the UI question "how does ask for this behavior"? A checkbox could be added to Prefs/Look & feel/Tag browser, but that might be too hard to use if what one wants is a toggle. Adding another button to the search bar seems overkill. It could be added to the TB context menu.

What do you think?