search operator word with dash

132 views
Skip to first unread message

j t

unread,
Jan 26, 2020, 10:48:02 AM1/26/20
to tiddl...@googlegroups.com
Hello,


I'm searching for "term-1" with this:

<$list filter="[tag[my-tag]search:list{search/query!!list}]"> </$list>.

In the list field of tiddler "search/query" is my search term "term-1"

The resulting list with tiddlers also includes "term-10" (or "term-11" etc.).

How do I get the list to only mention tiddlers that have "term-1" in their list field ?


Regards, Trend.




PMario

unread,
Jan 26, 2020, 11:17:08 AM1/26/20
to TiddlyWiki
Hi,

This filter: [tag[my-tag]regexp:list[^term-1$]]  should do the trick.

It uses regexp search.

-mario

PMario

unread,
Jan 26, 2020, 11:47:38 AM1/26/20
to TiddlyWiki
uups,
I missed something.

This should work with a dynamic search term now..

\define fragment() ^$(term)$$

<$set name=term value={{search/query!!list}}>
<$list filter="[tag[my-tag]regexp:list<fragment>]"></$list>
</$set>


have fun!
mario

PMario

unread,
Jan 26, 2020, 11:49:32 AM1/26/20
to TiddlyWiki
Hi,

Why is your search term stored in a list like: search/query!!list ??

-m

tren...@outlook.com

unread,
Jan 26, 2020, 3:33:24 PM1/26/20
to TiddlyWiki
Hi Mario,

Thank you for your answer.

search/query!!list gathers a number of (different) search terms.  (e.g. term-1 other-15 other-1 category-5)
The search terms are used to make a list of tiddlers that have at least all those terms in their list field. 

It can be combined with searches for other things like text (in attached notes) it uses the search/query!!text field for this. It is also possible to exclude 1 or 2 terms from the search . And a number of other fields like dates (to select a period) are also part of the "final search results". All different search terms are added to the tiddler "search/query".

I have a "content search" tiddler that makes it easy to add the "terms" (they are like tags in a list field). It is possible to add many tags/terms. 
Below the input section for the search terms is a list with the search results.

Your solution works for 1 search term. How could I expand it to search for multiple terms ?

Regards, Trend.


From: tiddl...@googlegroups.com <tiddl...@googlegroups.com> on behalf of PMario <pmar...@gmail.com>
Sent: Sunday, January 26, 2020 5:49 PM
To: TiddlyWiki <tiddl...@googlegroups.com>
Subject: [tw5] Re: search operator word with dash
 
Hi,

Why is your search term stored in a list like: search/query!!list ??

-m

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/124e531d-ba11-4aa8-8cf8-bcd3e479bbbd%40googlegroups.com.

TonyM

unread,
Jan 26, 2020, 3:50:11 PM1/26/20
to TiddlyWiki
Trend

Perhaps you need to search once for each term in the list.

Regards
tony


On Monday, January 27, 2020 at 7:33:24 AM UTC+11, tren...@outlook.com wrote:
Hi Mario,

Thank you for your answer.

search/query!!list gathers a number of (different) search terms.  (e.g. term-1 other-15 other-1 category-5)
The search terms are used to make a list of tiddlers that have at least all those terms in their list field. 

It can be combined with searches for other things like text (in attached notes) it uses the search/query!!text field for this. It is also possible to exclude 1 or 2 terms from the search . And a number of other fields like dates (to select a period) are also part of the "final search results". All different search terms are added to the tiddler "search/query".

I have a "content search" tiddler that makes it easy to add the "terms" (they are like tags in a list field). It is possible to add many tags/terms. 
Below the input section for the search terms is a list with the search results.

Your solution works for 1 search term. How could I expand it to search for multiple terms ?

Regards, Trend.


From: tiddl...@googlegroups.com <tiddl...@googlegroups.com> on behalf of PMario <pmar...@gmail.com>
Sent: Sunday, January 26, 2020 5:49 PM
To: TiddlyWiki <tiddl...@googlegroups.com>
Subject: [tw5] Re: search operator word with dash
 
Hi,

Why is your search term stored in a list like: search/query!!list ??

-m

--
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 tiddl...@googlegroups.com.

Mark S.

unread,
Jan 26, 2020, 7:14:56 PM1/26/20
to TiddlyWiki
Perhaps something like this:

<$list filter="[tag[my-tag]contains:mylist{search/query!!list}]">

</$list>.

Note that I changed "list" to "mylist". As PMario hinted, the "list" field has a special usage in TW. If any of your term-x fields are used as tags, then the "list" field could be accidentally overwritten. So it's probably better to use some other field, unless you're read for the consequences.

Good luck!
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@googlegroups.com.

tren...@outlook.com

unread,
Jan 26, 2020, 7:38:22 PM1/26/20
to TiddlyWiki
@Tony
I was thinking the same. 

I have the terms in the list field of tiddler "search/query". It could be 1 term or many. Depending on the amount of terms one would like to search.

I don't know how to approach this uncertain scenario. For "each term" do "this" search.

Any ideas/directions ?



@Mark S
I tried your solution and it works with 1 search term. But unfortunately not with multiple terms. 

I started out with the list field because some operations default automatically to it and it is a list. along the way I had to make use of other fields as well. So perhaps I will reconsider using the list field at all. Although at this point it doesn't really matter. But it's always good to have a bit more clarity on that. Thanks!

Any ideas on the "core problem" search multiple terms strict ?

Kind regards, Trend.


Mohammad Rahmani

unread,
Jan 26, 2020, 9:50:36 PM1/26/20
to tiddl...@googlegroups.com
I think the simplest is regexp.
See the attached file and look at the Search-Test tiddler.
By the way it is not good idea to put such search term in the list field.
List field has a special usecase in Tiddlywiki.



On Sun, Jan 26, 2020 at 7:17 PM j t <tren...@outlook.com> wrote:
Hello,


I'm searching for "term-1" with this:

<$list filter="[tag[my-tag]search:list{search/query!!list}]"> </$list>.


In the list field of tiddler "search/query" is my search term "term-1"

The resulting list with tiddlers also includes "term-10" (or "term-11" etc.).

So, you want exact word search, e.g whole word term-1 BUT NOT term-10 OR term-111

<$vars searchTerm={{{  [[search/query]get[list]addprefix[\b]addsuffix[\b]]   }}}>
<$list filter="[tag[myTag]search:list:regexp<searchTerm>]">

</$list>
</$vars>

How do I get the list to only mention tiddlers that have "term-1" in their list field ?


Regards, Trend.




--
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+unsubscribe@googlegroups.com.
search-test.json

Mark S.

unread,
Jan 26, 2020, 10:03:23 PM1/26/20
to TiddlyWiki
So you have multiple terms in your search, and multiple terms in your list field? Try:

<$list filter="[list[search/query!!list]]" variable="listitem">
<$list filter="[tag[my-tag]contains:mylist
<listitem>]">

</$list>
</$list>.

The problem with "list" field is that it is tied to tags. Make a tiddler "test". Then make a tiddler using "new here" off of test and call it "stuff" (it's down on the drop-down menu). Then make another tiddler the same way and call it "stuff2".
On "stuff" or "stuff2" click on the tag "test". There will be a dropdown list. Click and hold on one of the items in the dropdown list to re-arrange it. Now open the "test" tiddler. The "list" field will contain "stuff" and "stuff2". This is really useful
behaviour at times, but it's why you might want to use some other field (like "mylist" in my example) to contain an array of values. It might not make any difference -- it depends on your data.

tren...@outlook.com

unread,
Jan 27, 2020, 8:12:45 AM1/27/20
to tiddl...@googlegroups.com

@ Mark S

This seems like a nice step in the right direction.

I see that the filter is searching for each search term and appending all results for each term to a list.

 

Would it be possible to select only the tiddlers that are mentioned twice (or as much as there are search terms) ? I tried but didn’t succeed.

 

 

@Mohammad

Very clever thinking. Nice trick! And thanks for the test setup.

 

Yes I do want the exact search term. But the problem is when using multiple search terms.

 

When using your setup. If I search for term-1 AND term-14 I want the result to be tiddler C (having both term-1 AND term-14).

 

I don’t want the result to be the tiddlers that have term-1 OR term-14 OR both.

 

 

@all helping out

//I will take a look at the list field again and see if I can change it to something else. // Everybody happy!

 

 

 

 

tren...@outlook.com

unread,
Jan 27, 2020, 12:55:24 PM1/27/20
to tren...@outlook.com, tiddl...@googlegroups.com
I think I've come up with a solution.

\define list-contain()
<$list filter="[enlist{search/query!!list}]" variable="list">
<$list filter="[tag[myTag]contains:list<list>]" variable="result">
<<result>>
</$list></$list>
\end

\define list-remove()
<$list filter="[enlist{search/query!!list}]" variable="list">
<$list filter="[tag[myTag]!contains:list<list>]" variable="result">
<<result>>
</$list></$list>
\end

\define contain-clean()
<$wikify name="input" text=<<list-contain>>>
<$list filter="[enlist:raw<input>] +[sortan[]] +[split[ ]]" variable="list">
<$list filter="[enlist:dedupe<list>]" variable="result">
<<result>>
</$list></$list></$wikify>
\end

\define remove-clean()
<$wikify name="input" text=<<list-remove>>>
<$list filter="[enlist:raw<input>] +[sortan[]] +[split[ ]]" variable="list">
<$list filter="[enlist:dedupe<list>]" variable="result">
<<result>>
</$list></$list></$wikify>
\end

 Search Results:

<$wikify name="input-1" text=<<contain-clean>>  ><$wikify name="input-2" text=<<remove-clean>>  >
<$list filter="[enlist<input-1>] +[remove<input-2>]" variable="result">
<<result>>
</$list></$wikify></$wikify>

It seems to work for both single and multiple searches. 

Thanks everyone for helping.

Kind regards, Trend.



From: tiddl...@googlegroups.com <tiddl...@googlegroups.com> on behalf of tren...@outlook.com <tren...@outlook.com>
Sent: Monday, January 27, 2020 2:12 PM
To: tiddl...@googlegroups.com <tiddl...@googlegroups.com>
Subject: RE: [tw5] Re: search operator word with dash
 
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/DBBPR03MB5142ADE5D1407FA4B83D27FDF80B0%40DBBPR03MB5142.eurprd03.prod.outlook.com.
Reply all
Reply to author
Forward
0 new messages