Workaround to filter Bases tables with a search box using metabind plugin

I was looking for a workaround to the current limitation of Bases tables that cannot be searched or filtered without adding permanent filters. This is directly related to this FR.

I discovered the metabind plugin watching this YT video, and tried to combine it with code filters in Base, and it seems to be working well. If anyone is interested, I thought I would share it, and maybe someone could even improve it.

I am just coming back to Obsidian after a long time so I am just (re)discovering the plugins, and I have not tested it extensively yet but for what I could skim of Metabind documentation, it could open the door to dropdown filters as well.

Here is how to reproduce my little test:

  1. Install and enable metabind
  2. Create a note in a folder containing others
  3. Paste the following snippet in the note’s body to get
    • A Base table list of all notes in the current note’s folder
    • A search box which content syncs with the value of our searchBox property
      • When the search box is empty, all files are listed in the Base table
      • the table is filtered by file names as you start typing in the search box
---
searchBox: ""
---

`INPUT[text:searchBox]`

```base
views:
  - type: table
    name: Table
    filters:
      and:
        - file.folder == this.file.folder
        - or:
            - this.searchBox == ""
            - file.name.contains(this.searchBox)
    sort:
      - property: file.name
        direction: ASC
```

8 Likes

I tweaked it a bit for myself to also check aliases:

    - or:
        - file.name.contains(this.searchBox)
        - this.searchBox.isEmpty()
        - aliases.join(" ").contains(this.searchBox)
2 Likes

Nice improvement, thanks for sharing :+1:

2 Likes

In addition to providing a very useful enhancement to Bases, this is the first example of using the Metabind plugin that has seemed necessary or essential to me (or to the way I work, anyway), so thank you for that, too.

3 Likes

In the new version 1.9.8 (currently only available to Catalyst users), when creating a base file within a note, the ability to search for text within the file name has been introduced. You can now press Ctrl+F, just like you would to search for text within any note.

1 Like

I’m on 1.9.9 still can’t search inside Base.

unable to perform quick search (Ctrl+F) action in

  1. .base
  2. base code block
  3. embedded .base.

But meta-bind search work pretty fast on base code block though.

It seems strange to me. I also installed 1.9.9, and I can confirm that it is possible to search using Ctrl F. However, you can only do this when the base file is inside an .md note, and furthermore the search only occurs within the file names.