Customizing Search Results Filter

Hi, kinda newbie here. I want to create a new search results list that uses a different filter. I could have a list that includes missing links, another that only searches stream root tiddlers, etc. The two solutions I can see are:

  1. Clone the $:/core/ui/DefaultSearchResultList, then tweak the filter
  2. Make my own list like with the Context Search plugin, forfeiting the keyboard driven navigation (up and down arrows to move through the results and other fancy stuff)

I’ve sneaked around the core search results tiddlers but I can’t find the line where one could sneak in an added filter step. Does anyone know how to do solution 1? Has this been asked before?

Thanks!

The Field Search plugin does this nicely. You get to keep the fancy navigation, etc.

Adding new search filters is a breeze. Changing the default requires a bit more fiddling, depending on your theme.

To give you a practical example, I created a custom search result filter that’s geared towards searching through a corpus of scientific studies for instance, consisting of a bibtex-targeted first-search-filter ([!is[system]tag[3bibtex-entry]search:bibtex-title, bibtex-author, bibtex-keywords<userInput>sort[title]limit[20]]) and displaying the first 70 characters of bibtex-title above the tiddler title.

2021-09-30_15-56

I also changed my core search because I wanted to run the search through aliases and BibTex-related fields. It consists of an enhanced first-search-filter ([!is[system]search:title, book-title, bibtex-title, bibtex-author, aliases<userInput>limit[30]] — instead of the 250-limit title-only filter) and an unchanged second-search-filter doing a full-text search.

Thanks a lot! I’ll check it out.

I was very blind. I have been looking at the core search tiddlers for two days now and I did not look at the fields of the $:/core/ui/DefaultSearchResultList . For anyone with the same question and also has bad eyes like me, the two search filters (1st: search only title, 2nd: search all fields) are in the fields.

1 Like

Happy you got that to work. Indeed, the fields were a bit unexpected.

My custom filters are still probably worth sharing: $__PIM_PowerSearch.tid (1.2 KB) $__PIM_ScienceBase.tid (778 Bytes).

I use NicolasPetton’s beautiful Notebook theme. To make my PowerSearch the new default, I did the following:

  • In $:/themes/nico/notebook/ui/Topbar, I changed the reference to $:/themes/nico/notebook/ui/Search to $:/core/ui/SideBarSegments/search.
  • In $:/core/ui/SideBarSegments/search, I removed count-popup-button and cancel-search-actions and its associated button, as well as an extra div introducing an unfortunate line break before the text search area.

Some of this will also probably be valid on the vanilla theme or other custom themes.