Find the corresponding tiddlers in the advanced search based on the content type in the tiddler and the information in the field content

Maybe this will make the search more efficient

I don’t fully understand your question. In particular, what do you mean by “the corresponding tiddlers”?

The advanced search interface has a filter-condition tab. You can use it to specify any complex set of criteria you need to find.

For example, you could search under this filter condition

[type[application/javascript]module-type[macro]]

… to find tiddlers with a particular type, and with particular contents in a field.

Do you mean that you want an efficient way — when you’re starting with a particular tiddler — to look for tiddlers that are SIMILAR in their type and in some particular field’s contents?

3 Likes

Wandering around the theme I created, thinking this post is nearing completion, actually it isn’t, sorry my friends

Using $:/AdvancedSearch just a simple search for “tmap.id” or “233” does not yield any results, in fact there are many common tiddlers with this field, especially “tmap.id” may be the result of my installation of the tiddlywikimap plugin long, long ago. Although I uninstalled it, the previously affected tiddlers fields are still there

For example, I want to filter tiddlers with fields “tmap.id” and “233” by filtering

I had to take a turn and use python to help me remove all these superfluous fields, which may seem unwise to you

# python source code
import json

# 假设这是你的JSON文件的路径
json_file_path = 'your_file.json'

# 读取JSON文件
with open(json_file_path, 'r', encoding='utf-8') as file:
    data = json.load(file)

# 删除数组中所有对象的 "tmap.id" 字段
if isinstance(data, list):
    for item in data:
        if 'tmap.id' in item:
            del item['tmap.id']

# 将修改后的数据写回文件
with open(json_file_path, 'w', encoding='utf-8') as file:
    json.dump(data, file, ensure_ascii=False, indent=4)

print('所有 "tmap.id" 字段已被删除。')

Any reply would be greatly appreciated

To find those, you don’t need “type” 233. (Tiddler “type” is itself a field, used to distinguish different kinds of images, javascript, etc.)

You need [has[233]] to get tiddlers with values in the 233 field.

1 Like

I might understand that the tiddlers filtered by “[has[tmap.id]]” must be “tmap.id:123456” but not “tmap.id:”.

How might I search for 000 here

To check for the existence of a field with a blank value, add the :field suffix to the operator, like this:

[has:field[tmap.id]]

To search for a specific field value, you can use the field:fieldname[fieldvalue] operator, like this:

[field:233[000]]

Also, as noted here: https://tiddlywiki.com/#field%20Operator

The syntax of a filter step treats any unrecognised filter operator as if it was the suffix to the field operator.

Thus, as long as the desired fieldname is not also the name of a filter operator, you can use the short-form to find a specific field value, like this:

[233[000]]

-e

1 Like

Everything is wonderful. Thank you so much