TW5: search in fields

275 views
Skip to first unread message

Roman Solodukhin

unread,
Sep 10, 2013, 7:40:11 AM9/10/13
to tiddl...@googlegroups.com
Why search do not work in fields?


Jeremy Ruston

unread,
Sep 10, 2013, 7:56:52 AM9/10/13
to tiddl...@googlegroups.com
Searching in fields isn't implemented yet, but will come during the beta,

Best wishes

Jeremy

Sent from Mailbox for iPad


On Tue, Sep 10, 2013 at 12:40 PM, Roman Solodukhin <xrob...@gmail.com> wrote:

Why search do not work in fields?


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Roman Solodukhin

unread,
Sep 10, 2013, 8:03:26 AM9/10/13
to tiddl...@googlegroups.com
Thanks for response jeremy.
I will wait.

Mike

unread,
Feb 5, 2014, 1:21:17 PM2/5/14
to tiddl...@googlegroups.com
I had exactly the same question, and it turns out that searching in fields already works! It's just a bit of a kludge. :)

By using the <$list> widget you can take advantage of the richer filter syntax. I couldn't find where it's documented, but you can figure it out pretty easily by digging through the source code.

The general syntax is:
<filterString> ::= "[" <filter-list> "]"
<filter-list> ::= <filter> | <filter> <filter>
<filter> ::= <filter-operator><filter-argument>
<filter-operator> ::= <filter-operator-prefix>";"<filter-operator-name>":"<filter-operator-suffix>
<filter-operator-prefix> ::= a prefix | ""
<filter-operator-name> ::= "is" | "has" | "each" | "field" ... (see complete list by looking in
$:/core/modules/filters/ on the internals tab of the Control Panel)
<filter-operator-suffix> ::= a suffix | ""

<filter-argument> ::= "["<search-string>"]" |
"{"<indirect-search-string>"}" | <regex>
<regex> ::= "/"<regex-string>"/" | "/"<regex-string>"/""("<regex-args>")"
<regex-string> ::= a javascript regular expression
<regex-args> ::= [mygi] (for global, case insensitive, etc.)


* Note that the parser was simplified by treating regex "/" as a "bracket" of sorts, meaning there could
only be a start and end bracket. Thus the regex arguments, like i, are included in parenthesis immediately following the trailing "/".

* Note also that I haven't quite figured out what the "indirect search string" does, nor what uses operator-prefixes have. :)

The neat thing is that by allowing both a suffix and an argument (which the code actually calls an operand) you can do things like:
<$list filter="[field:fieldName[searchString]"></$list>

or, using regex brackets,
<$list filter="[field:fieldName/caseInsensitiveSearchString/(i)"></$list>


TL;DR:

To search in fields create a new tiddler. Add the following to it:
<$list filter={{!!searchbox}}>
</$list>

Then add a field named "searchbox." Turn on the preview pane (the "show preview" button) and type the following into the searchbox field:
[field:abcde/fghij/(i)]

Where "abcde" is the field name you want to search and "fghij" is the string you want to search for. You will immediately see a list of matching tiddlers.

Cheers,

Mike

Martian

unread,
Apr 22, 2016, 12:40:57 PM4/22/16
to TiddlyWiki
Hello!

Just want to clarify. Is a search in fields implemented already? Seems "no" to me :/

Or to search by fields values I should use AdvancedSearch/Filter and put "[field:abcde/fghij/(i)]" as Mike had proposed?

WBR,
Martian.

Jeremy Ruston

unread,
Apr 24, 2016, 10:59:05 AM4/24/16
to tiddl...@googlegroups.com
Hi Martian

Just want to clarify. Is a search in fields implemented already? Seems "no" to me :/

Correct, the core search still only looks at the title, tags and body fields.

Best wishes

Jeremy
Reply all
Reply to author
Forward
0 new messages