[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread amreus
Yes Eric that is exactly what I meant.  It's basically a location search 
for common gedcom tags (which are not the same as TiddlyWiki tags.)  

Thanks so much for the examples. 

I have been reading about macros but I still don't think I grasp them fully 
yet. However, though experimentation I have come up with the following 2 
examples which give me better control over the title lists. The first works 
fine. I prefer the 2nd example as it's more general.  I think it can 
generalize even more into a macro named "location-search" maybe. Something 
similar to <>

First Example:

\define searchflds()
<$list filter="[search:$(flds)$[California]]">


\end

<$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
<>


Second Example:

\define search-filter(term) [search:$(flds)$[$term$]]

<$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
<$list filter=<> >
<$link>{{!!caption}} {{||year-span}}




On Saturday, August 29, 2020 at 2:40:50 PM UTC-4 Eric Shulman wrote:

> On Saturday, August 29, 2020 at 11:24:46 AM UTC-7, Eric Shulman wrote:
>>
>> \define searchflds() {{{ [search:$(flds)$[query]] }}}
>>
>> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
>> <>
>> 
>>
>  
> Addendum:
>
> The above code will work, but... it searches for each field name 
> separately.  As a result, if there are multiple fieldnames in the same 
> tiddler that contain the query text, that tiddler will be listed multiple 
> times.
>
> Your intuition to use "join[,]" to construct a list of fields is actually 
> the better approach.  Thus:
> \define searchflds() {{{ [search:$(flds)$[query]] }}}
>
> <$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
> <>
> 
>
> Notes:
> * the $vars finds all fieldnames ending in "_plac" and assembles a 
> comma-separated list
> * the searchflds macro then uses that list of fieldnames to find the 
> occurrences of "query" within any of those fields
>
> Because the search is looking in all of the "_plac" fieldnames at the same 
> time, any matching tiddlers are only listed once.
>
> -e
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ba6d9962-0a56-425e-bdd3-c03fa488a102n%40googlegroups.com.


[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread Eric Shulman
On Saturday, August 29, 2020 at 11:24:46 AM UTC-7, Eric Shulman wrote:
>
> \define searchflds() {{{ [search:$(flds)$[query]] }}}
>
> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
> <>
> 
>
 
Addendum:

The above code will work, but... it searches for each field name 
separately.  As a result, if there are multiple fieldnames in the same 
tiddler that contain the query text, that tiddler will be listed multiple 
times.

Your intuition to use "join[,]" to construct a list of fields is actually 
the better approach.  Thus:
<$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
<>


Notes:
* the $vars finds all fieldnames ending in "_plac" and assembles a 
comma-separated list
* the searchflds macro then uses that list of fieldnames to find the 
occurrences of "query" within any of those fields

Because the search is looking in all of the "_plac" fieldnames at the same 
time, any matching tiddlers are only listed once.

-e

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/51308e38-52e0-4dd8-b042-1651266f73aco%40googlegroups.com.


[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread Eric Shulman
On Saturday, August 29, 2020 at 10:31:20 AM UTC-7, amreus wrote:
>
> I would like to search all my tiddler's fields that match a regexp 
> /_plac$/ 
> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
> {{{
>   [search:<>[query]]
> }}}
> 
>

If I understand your goal correctly, you want to find all tiddlers that 
have a fieldname ending in "_plac" and then search those fields for a value 
that contains the text "query" and then show the names of those tiddlers

If that is the case, then you were very close.  The issue is that filter 
syntax doesn't permit use of variables in the suffix (e.g. the part after 
the colon in "search:suffix").

However, you can work around this by using a macro to substitute the 
variable value into the syntax, like this:
\define searchflds() {{{ [search:$(flds)$[query]] }}}

<$list filter="[fields[]regexp[_plac$]]" variable="flds">
<>


-e


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6489bf74-4bb9-4496-80d2-d2b9b41718b8o%40googlegroups.com.


[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread amreus
Here's is the actual filter. I thought maybe the join is more correct with 
the search operator:

[image: 2020-08-29_140459.png]

On Saturday, August 29, 2020 at 2:01:16 PM UTC-4 amreus wrote:

> I thought to reverse it also - that is search all fields for the term and 
> then filter the titles by the selected fields, but I didn't have any luck 
> with that filter syntax.  It's  possible I just haven't typed the filters 
> correctly.
>
>
>
> On Saturday, August 29, 2020 at 1:56:14 PM UTC-4 amreus wrote:
>
>> It is true I am still having difficulty with the appropriate contexts and 
>> meanings of the various types and amounts of brackets.
>>
>> But alas, it did not work.
>>
>>
>>
>> On Saturday, August 29, 2020 at 1:51:08 PM UTC-4 Mark S. wrote:
>>
>>> It will probably work if you just change <> to  inside the 
>>> internal filter. Inside of filters, variables use single angle brackets. 
>>> Outside filters, double angle brackets.
>>>
>>>
>>> On Saturday, August 29, 2020 at 10:31:20 AM UTC-7, amreus wrote:


 I would like to search all my tiddler's fields that match a regexp 
 /_plac$/ 

 Something like this not-valid syntax:

 <$list filter="[fields[]regexp[_plac$]]" variable="flds">
 {{{
   [search:<>[query]]
 }}}
 

 Is possible? 
 Thanks.

>>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8c466ee6-d93d-47e9-9e0a-b20d29b4d690n%40googlegroups.com.


[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread amreus
I thought to reverse it also - that is search all fields for the term and 
then filter the titles by the selected fields, but I didn't have any luck 
with that filter syntax.  It's  possible I just haven't typed the filters 
correctly.



On Saturday, August 29, 2020 at 1:56:14 PM UTC-4 amreus wrote:

> It is true I am still having difficulty with the appropriate contexts and 
> meanings of the various types and amounts of brackets.
>
> But alas, it did not work.
>
>
>
> On Saturday, August 29, 2020 at 1:51:08 PM UTC-4 Mark S. wrote:
>
>> It will probably work if you just change <> to  inside the 
>> internal filter. Inside of filters, variables use single angle brackets. 
>> Outside filters, double angle brackets.
>>
>>
>> On Saturday, August 29, 2020 at 10:31:20 AM UTC-7, amreus wrote:
>>>
>>>
>>> I would like to search all my tiddler's fields that match a regexp 
>>> /_plac$/ 
>>>
>>> Something like this not-valid syntax:
>>>
>>> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
>>> {{{
>>>   [search:<>[query]]
>>> }}}
>>> 
>>>
>>> Is possible? 
>>> Thanks.
>>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8eb59ca4-6141-4439-8475-fb71db1f1930n%40googlegroups.com.


[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread amreus
It is true I am still having difficulty with the appropriate contexts and 
meanings of the various types and amounts of brackets.

But alas, it did not work.



On Saturday, August 29, 2020 at 1:51:08 PM UTC-4 Mark S. wrote:

> It will probably work if you just change <> to  inside the 
> internal filter. Inside of filters, variables use single angle brackets. 
> Outside filters, double angle brackets.
>
>
> On Saturday, August 29, 2020 at 10:31:20 AM UTC-7, amreus wrote:
>>
>>
>> I would like to search all my tiddler's fields that match a regexp 
>> /_plac$/ 
>>
>> Something like this not-valid syntax:
>>
>> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
>> {{{
>>   [search:<>[query]]
>> }}}
>> 
>>
>> Is possible? 
>> Thanks.
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b0ab6063-ad19-4523-b215-ed1f1686bae0n%40googlegroups.com.


[tw5] Re: Search the values of fields where field names are generated?

2020-08-29 Thread 'Mark S.' via TiddlyWiki
It will probably work if you just change <> to  inside the 
internal filter. Inside of filters, variables use single angle brackets. 
Outside filters, double angle brackets.

On Saturday, August 29, 2020 at 10:31:20 AM UTC-7, amreus wrote:
>
>
> I would like to search all my tiddler's fields that match a regexp 
> /_plac$/ 
>
> Something like this not-valid syntax:
>
> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
> {{{
>   [search:<>[query]]
> }}}
> 
>
> Is possible? 
> Thanks.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8f48f742-d820-44f6-81ca-0903835db958o%40googlegroups.com.