Minlength for XXX in search[XXX]?

I want to apply a minlength check for the search[] operand (e.g “two characters”). It would be ideal if I could specify “minlength” directly in the search[] operator but there doesn’t seem possible. (I’ll post a GH issue - because the idea is reasonable, right?)

…so instead I want to add a minlength check to be performed before the search, but I’m wondering if it can be achieved in the same filter expression (as opposed to a wrapping listwidget)?

Thanx!

Please provide more details as to what you are trying to achieve.

Where is the filter to be used?
Where does the search term come from? What is the desired output of the filter if the search term is too short?

1 Like

[[your search]minlength[3]] :map:flat[all[tiddlers]search<currentTiddler>]

2 Likes

It turns out that a surrounding listwidget is probably better after all because the search string whose length is tested, will then be used as an operand in multiple places thereafter.

(Funny how you test and chew on something for days and finally decide to ask for help and - pop! - merely asking seems to solve it.)

Still, do you guys think it is reasonable for me to post a gh issue with a request to extend the search[] to accept a minlength? (e.g search::3<mysearch> )

Depending on use cases one could want different behaviours when the search operand is not long enough, such as returning nothing or returning all previous input unchanged. As such I do not feel this is something that should be handled by the search operator.

In the tiddler: $:/config/Search/MinLength

Set text field to: 2

I think that will work for you

Thanks. This wasn’t for the global search feature. Anyway it’s solved.