I've just programmed a small WikidPad extension that displays search
results in a dynamic section of a page. It's an extension on the "Copy
search results to clipboard" concept.
What it does:
* It does a wiki wide search for a given keyword.
* It then it grabs what I call "sections". This can simply be the line
where the keyword occurs, or it can be the lines from there until a
blank line is met, or all the child bullet points in a list (currently
only the last two are implemented).
* It outputs the resulting section list in an updateable area of the
current page.
I've been meaning to write this extension for some time (I have a ~450
pages/2MB personal wiki... info architecture becomes an issue :-) ).
It'd be great if it turns out to be useful for others. I'll add it on
the ListOfUserScripts page when it's a bit more tested (I'm on Linux,
using WP 1.9beta17, btw).
Please send comments, questions, bugs, etc. This is my first
extension, so there's certainly room for improvement.
> Hi!
>
> I've just programmed a small WikidPad extension that displays search
> results in a dynamic section of a page. It's an extension on the
"Copy
> search results to clipboard" concept.
>
> What it does:
>
> * It does a wiki wide search for a given keyword.
> * It then it grabs what I call "sections". This can simply be the
line
> where the keyword occurs, or it can be the lines from there until a
> blank line is met, or all the child bullet points in a list
(currently
> only the last two are implemented).
> * It outputs the resulting section list in an updateable area of the
> current page.
>
> Code/more info here:
> http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
>
> I've been meaning to write this extension for some time (I have a
~450
> pages/2MB personal wiki... info architecture becomes an issue :-) ).
> It'd be great if it turns out to be useful for others. I'll add it
on
> the ListOfUserScripts page when it's a bit more tested (I'm on
Linux,
> using WP 1.9beta17, btw).
>
> Please send comments, questions, bugs, etc. This is my first
> extension, so there's certainly room for improvement.
>
> Thanks!
> François Savard
> http://www.fsavard.com/flow
You are definitely on to something. There are few things wrong with
your approach:
1. You make duplicates of section. They need manual updating, and if
you use DynamicSearch on two wiki pages, the results of one search
can be included in other search.
2. You use heading "+++ End DynSearchResults"
3. You don't link to original sections
IMHO it could be improved by using insertation, for example:
[:dynsearch: deadline]
There would be no duplicates in wiki database (search results would
be generated with preview), you wouldn't need a marker for end of
results, and they would always be in sync.
BTW extension is working as intended on Wikipad 1.9beta18_4 on
Windows XP
--- In wikidPad@yahoogroups.com, "josip_ine" <josipmiskovic@...> wrote:
>
> > Hi!
> >
> > I've just programmed a small WikidPad extension that displays search
> > results in a dynamic section of a page. It's an extension on the
> "Copy
> > search results to clipboard" concept.
> >
> > What it does:
> >
> > * It does a wiki wide search for a given keyword.
> > * It then it grabs what I call "sections". This can simply be the
> line
> > where the keyword occurs, or it can be the lines from there until a
> > blank line is met, or all the child bullet points in a list
> (currently
> > only the last two are implemented).
> > * It outputs the resulting section list in an updateable area of the
> > current page.
> >
> > Code/more info here:
> > http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
> >
> > I've been meaning to write this extension for some time (I have a
> ~450
> > pages/2MB personal wiki... info architecture becomes an issue :-) ).
> > It'd be great if it turns out to be useful for others. I'll add it
> on
> > the ListOfUserScripts page when it's a bit more tested (I'm on
> Linux,
> > using WP 1.9beta17, btw).
> >
> > Please send comments, questions, bugs, etc. This is my first
> > extension, so there's certainly room for improvement.
> >
> > Thanks!
> > François Savard
> > http://www.fsavard.com/flow
>
>
> You are definitely on to something. There are few things wrong with
> your approach:
> 1. You make duplicates of section. They need manual updating, and if
> you use DynamicSearch on two wiki pages, the results of one search
> can be included in other search.
> 2. You use heading "+++ End DynSearchResults"
> 3. You don't link to original sections
>
> IMHO it could be improved by using insertation, for example:
> [:dynsearch: deadline]
> There would be no duplicates in wiki database (search results would
> be generated with preview), you wouldn't need a marker for end of
> results, and they would always be in sync.
>
> BTW extension is working as intended on Wikipad 1.9beta18_4 on
> Windows XP
>
> Thanks for sharing
> Josip
>
I've taken a look at how other insertion plugins work. It does
definitely make sense to do it that way. I tend to stay in edit mode,
though, which is why I liked the first option.
Another way I could have solved that problem is by simply not
considering the lines which are part of search results, which is
possible due to the way I process pages found by the wiki wide search,
ie. line by line.
(By the way I was inspired in using "+++ End DynSearchResults" by the
setArea code found in the TagView extension)
OK I've changed the behavior to use a [:dynsearch: keywords...]
syntax, by using the insertion plugin mechanism, as suggested by
Josip. Basic manual testing shows it works for me in both WP 1.9beta17
and 1.8rc9.
Results are now presented in a cleaner way, I think, and page titles
are now links.
If a few of you want to try it out in other settings, I'd appreciate
it. (I've written a few unit tests, but they're pretty limited).
Btw thanks to those (2) who sent me reports and suggestions by email.
--- In wikidPad@yahoogroups.com, "josip_ine" <josipmiskovic@...> wrote:
>
> > Hi!
> >
> > I've just programmed a small WikidPad extension that displays search
> > results in a dynamic section of a page. It's an extension on the
> "Copy
> > search results to clipboard" concept.
> >
> > What it does:
> >
> > * It does a wiki wide search for a given keyword.
> > * It then it grabs what I call "sections". This can simply be the
> line
> > where the keyword occurs, or it can be the lines from there until a
> > blank line is met, or all the child bullet points in a list
> (currently
> > only the last two are implemented).
> > * It outputs the resulting section list in an updateable area of the
> > current page.
> >
> > Code/more info here:
> > http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
> >
> > I've been meaning to write this extension for some time (I have a
> ~450
> > pages/2MB personal wiki... info architecture becomes an issue :-) ).
> > It'd be great if it turns out to be useful for others. I'll add it
> on
> > the ListOfUserScripts page when it's a bit more tested (I'm on
> Linux,
> > using WP 1.9beta17, btw).
> >
> > Please send comments, questions, bugs, etc. This is my first
> > extension, so there's certainly room for improvement.
> >
> > Thanks!
> > François Savard
> > http://www.fsavard.com/flow
>
>
> You are definitely on to something. There are few things wrong with
> your approach:
> 1. You make duplicates of section. They need manual updating, and if
> you use DynamicSearch on two wiki pages, the results of one search
> can be included in other search.
> 2. You use heading "+++ End DynSearchResults"
> 3. You don't link to original sections
>
> IMHO it could be improved by using insertation, for example:
> [:dynsearch: deadline]
> There would be no duplicates in wiki database (search results would
> be generated with preview), you wouldn't need a marker for end of
> results, and they would always be in sync.
>
> BTW extension is working as intended on Wikipad 1.9beta18_4 on
> Windows XP
>
> Thanks for sharing
> Josip
>
> OK I've changed the behavior to use a [:dynsearch: keywords...]
> syntax, by using the insertion plugin mechanism, as suggested by
> Josip. Basic manual testing shows it works for me in both WP
1.9beta17
> and 1.8rc9.
>
> Results are now presented in a cleaner way, I think, and page titles
> are now links.
>
> If a few of you want to try it out in other settings, I'd appreciate
> it. (I've written a few unit tests, but they're pretty limited).
>
> Btw thanks to those (2) who sent me reports and suggestions by
email.
>
> Link again:
> http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
>
> François
Works great now. I'm going to use this for a while to see if further
modifications are needed, and if I make any changes, I'll let you
know.
1)
[:dynsearch:word] finds occurences of "word", "xyword", "wordxy" and
"xywordxy" - this is sometimes useful, sometimes not. It would be nice
to have a way to find just "word" (and maybe even to disttinguish
between "word" and "Word"...).
2)
There seems to be no way to find "[word" or "wo:rd".
Something like [:dynsearch:\[wo\:rd] would be useful -
e.g. to have a page which lists all pages with an attribute [word:true]
Both of your wishes end up being satisfied, I think, by allowing for
regular expressions, so I modified the extension so you can use those
if needed. You can use this new syntax:
[:dynsearch_re: "your_expression_here"]
For example, to search for [word: true] pages (your 2nd point), you
can do:
[:dynsearch_re: "\[word:\s?true\]"]
and to search for complete words and not partial ones (your 1st point):
[:dynsearch_re: "\byourword\b"]
(\b indicates word boundaries).
I haven't changed the case behavior ("Word" vs "word"), but if you
really want it to be case sensitive, remove ", re.I" (search for it in
the code) and it should do the trick.
---
Be very careful with regular expressions, though, as it's easy to
create an expression that's very general accidentally. For example, I
tried:
[:dynsearch_re: "[t: test]"]
(--DON'T DO THAT--)
and, as it should, it searched for every occurrence of t, e, s, :, t
or space in the whole wiki (makes for a lot of results :P ).
---
Thanks for your suggestions. I hope the changes work for you.
François
--- In wikidPad@yahoogroups.com, melchior prisi <mprisi@...> wrote:
>
> Hi François
>
> ----- on 18.10.2008 22:55 f.savard wrote:
> > Link again:
> > http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
>
> I installed your extension and I like it!
>
> Two wishes:
>
> 1)
> [:dynsearch:word] finds occurences of "word", "xyword", "wordxy" and
> "xywordxy" - this is sometimes useful, sometimes not. It would be nice
> to have a way to find just "word" (and maybe even to disttinguish
> between "word" and "Word"...).
>
> 2)
> There seems to be no way to find "[word" or "wo:rd".
> Something like [:dynsearch:\[wo\:rd] would be useful -
> e.g. to have a page which lists all pages with an attribute [word:true]
>
>
> Thanks
> Melchior
> --
>
Can you tell me how this is different from the "saved search"
insertion. Thát also does a dynamic search and inserts it's results as
a list of page links.
Jan Stegehuis
--- In wikidPad@yahoogroups.com, "f.savard" <francois.savard@...> wrote:
>
> Hi Melchior.
>
> Both of your wishes end up being satisfied, I think, by allowing for
> regular expressions, so I modified the extension so you can use those
> if needed. You can use this new syntax:
>
> [:dynsearch_re: "your_expression_here"]
>
> For example, to search for [word: true] pages (your 2nd point), you
> can do:
>
> [:dynsearch_re: "\[word:\s?true\]"]
>
> and to search for complete words and not partial ones (your 1st point):
>
> [:dynsearch_re: "\byourword\b"]
>
> (\b indicates word boundaries).
>
> I haven't changed the case behavior ("Word" vs "word"), but if you
> really want it to be case sensitive, remove ", re.I" (search for it in
> the code) and it should do the trick.
>
> ---
>
> Be very careful with regular expressions, though, as it's easy to
> create an expression that's very general accidentally. For example, I
> tried:
>
> [:dynsearch_re: "[t: test]"]
> (--DON'T DO THAT--)
>
> and, as it should, it searched for every occurrence of t, e, s, :, t
> or space in the whole wiki (makes for a lot of results :P ).
>
> ---
>
> Thanks for your suggestions. I hope the changes work for you.
> François
>
> --- In wikidPad@yahoogroups.com, melchior prisi <mprisi@> wrote:
> >
> > Hi François
> >
> > ----- on 18.10.2008 22:55 f.savard wrote:
> > > Link again:
> > > http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
> >
> > I installed your extension and I like it!
> >
> > Two wishes:
> >
> > 1)
> > [:dynsearch:word] finds occurences of "word", "xyword", "wordxy" and
> > "xywordxy" - this is sometimes useful, sometimes not. It would be nice
> > to have a way to find just "word" (and maybe even to disttinguish
> > between "word" and "Word"...).
> >
> > 2)
> > There seems to be no way to find "[word" or "wo:rd".
> > Something like [:dynsearch:\[wo\:rd] would be useful -
> > e.g. to have a page which lists all pages with an attribute
[word:true]
> >
> >
> > Thanks
> > Melchior
> > --
> >
>
Err, you had me scared for a few seconds! :P Curiously I searched
quite a bit for this feature yet the only thing I found in WikidPad
was the "Copy results to clipboard" in the Search wiki dialog.
Yet, now that I've looked at the doc, there are clear differences:
1. My dynsearch extension searches for occurrences of the term IN the
page, not just whole pages that contain the term.
2. It returns the text surrounding every occurrence (what I call
"sections") of it in the page and prints it with the results (vs just
the page title).
(3. It now allows for regexps)
The goal of the first 2 features is two decrease information
repetition, ie. you can put info on SomeSubject anywhere in the wiki,
as long as you put the right keywords in the context, it'll grab all
those mentions and bring all the text in one place.
Compare that to having to repeat information in many places when it
concerns many entries. (You can find a clearer explanation of this on
my site, as linked in the original posts).
Thanks for the interest,
François
--- In wikidPad@yahoogroups.com, "janstegehuis" <janstegehuis@...> wrote:
>
> Francois,
>
> Can you tell me how this is different from the "saved search"
> insertion. Thát also does a dynamic search and inserts it's results as
> a list of page links.
>
> Jan Stegehuis
>
> --- In wikidPad@yahoogroups.com, "f.savard" <francois.savard@> wrote:
> >
> > Hi Melchior.
> >
> > Both of your wishes end up being satisfied, I think, by allowing for
> > regular expressions, so I modified the extension so you can use those
> > if needed. You can use this new syntax:
> >
> > [:dynsearch_re: "your_expression_here"]
> >
> > For example, to search for [word: true] pages (your 2nd point), you
> > can do:
> >
> > [:dynsearch_re: "\[word:\s?true\]"]
> >
> > and to search for complete words and not partial ones (your 1st
point):
> >
> > [:dynsearch_re: "\byourword\b"]
> >
> > (\b indicates word boundaries).
> >
> > I haven't changed the case behavior ("Word" vs "word"), but if you
> > really want it to be case sensitive, remove ", re.I" (search for it in
> > the code) and it should do the trick.
> >
> > ---
> >
> > Be very careful with regular expressions, though, as it's easy to
> > create an expression that's very general accidentally. For example, I
> > tried:
> >
> > [:dynsearch_re: "[t: test]"]
> > (--DON'T DO THAT--)
> >
> > and, as it should, it searched for every occurrence of t, e, s, :, t
> > or space in the whole wiki (makes for a lot of results :P ).
> >
> > ---
> >
> > Thanks for your suggestions. I hope the changes work for you.
> > François
> >
> > --- In wikidPad@yahoogroups.com, melchior prisi <mprisi@> wrote:
> > >
> > > Hi François
> > >
> > > ----- on 18.10.2008 22:55 f.savard wrote:
> > > > Link again:
> > > > http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
> > >
> > > I installed your extension and I like it!
> > >
> > > Two wishes:
> > >
> > > 1)
> > > [:dynsearch:word] finds occurences of "word", "xyword", "wordxy" and
> > > "xywordxy" - this is sometimes useful, sometimes not. It would
be nice
> > > to have a way to find just "word" (and maybe even to disttinguish
> > > between "word" and "Word"...).
> > >
> > > 2)
> > > There seems to be no way to find "[word" or "wo:rd".
> > > Something like [:dynsearch:\[wo\:rd] would be useful -
> > > e.g. to have a page which lists all pages with an attribute
> [word:true]
> > >
> > >
> > > Thanks
> > > Melchior
> > > --
> > >
> >
>
This is in fact a combination of a [:savedsearch: <searchname>] and a
[:page: <page name>] insertion but based on page sections instead of
whole pages. Looks like a good thing to have.
Jan
--- In wikidPad@yahoogroups.com, "f.savard" <francois.savard@...> wrote:
>
> Err, you had me scared for a few seconds! :P Curiously I searched
> quite a bit for this feature yet the only thing I found in WikidPad
> was the "Copy results to clipboard" in the Search wiki dialog.
>
> Yet, now that I've looked at the doc, there are clear differences:
>
> 1. My dynsearch extension searches for occurrences of the term IN the
> page, not just whole pages that contain the term.
>
> 2. It returns the text surrounding every occurrence (what I call
> "sections") of it in the page and prints it with the results (vs just
> the page title).
>
> (3. It now allows for regexps)
>
> The goal of the first 2 features is two decrease information
> repetition, ie. you can put info on SomeSubject anywhere in the wiki,
> as long as you put the right keywords in the context, it'll grab all
> those mentions and bring all the text in one place.
>
> Compare that to having to repeat information in many places when it
> concerns many entries. (You can find a clearer explanation of this on
> my site, as linked in the original posts).
>
> Thanks for the interest,
> François
>
> --- In wikidPad@yahoogroups.com, "janstegehuis" <janstegehuis@> wrote:
> >
> > Francois,
> >
> > Can you tell me how this is different from the "saved search"
> > insertion. Thát also does a dynamic search and inserts it's results as
> > a list of page links.
> >
> > Jan Stegehuis
> >
> > --- In wikidPad@yahoogroups.com, "f.savard" <francois.savard@> wrote:
> > >
> > > Hi Melchior.
> > >
> > > Both of your wishes end up being satisfied, I think, by allowing for
> > > regular expressions, so I modified the extension so you can use
those
> > > if needed. You can use this new syntax:
> > >
> > > [:dynsearch_re: "your_expression_here"]
> > >
> > > For example, to search for [word: true] pages (your 2nd point), you
> > > can do:
> > >
> > > [:dynsearch_re: "\[word:\s?true\]"]
> > >
> > > and to search for complete words and not partial ones (your 1st
> point):
> > >
> > > [:dynsearch_re: "\byourword\b"]
> > >
> > > (\b indicates word boundaries).
> > >
> > > I haven't changed the case behavior ("Word" vs "word"), but if you
> > > really want it to be case sensitive, remove ", re.I" (search for
it in
> > > the code) and it should do the trick.
> > >
> > > ---
> > >
> > > Be very careful with regular expressions, though, as it's easy to
> > > create an expression that's very general accidentally. For
example, I
> > > tried:
> > >
> > > [:dynsearch_re: "[t: test]"]
> > > (--DON'T DO THAT--)
> > >
> > > and, as it should, it searched for every occurrence of t, e, s, :, t
> > > or space in the whole wiki (makes for a lot of results :P ).
> > >
> > > ---
> > >
> > > Thanks for your suggestions. I hope the changes work for you.
> > > François
> > >
> > > --- In wikidPad@yahoogroups.com, melchior prisi <mprisi@> wrote:
> > > >
> > > > Hi François
> > > >
> > > > ----- on 18.10.2008 22:55 f.savard wrote:
> > > > > Link again:
> > > > > http://www.fsavard.com/flow/wikidpad-dynamic-search-results/
> > > >
> > > > I installed your extension and I like it!
> > > >
> > > > Two wishes:
> > > >
> > > > 1)
> > > > [:dynsearch:word] finds occurences of "word", "xyword",
"wordxy" and
> > > > "xywordxy" - this is sometimes useful, sometimes not. It would
> be nice
> > > > to have a way to find just "word" (and maybe even to disttinguish
> > > > between "word" and "Word"...).
> > > >
> > > > 2)
> > > > There seems to be no way to find "[word" or "wo:rd".
> > > > Something like [:dynsearch:\[wo\:rd] would be useful -
> > > > e.g. to have a page which lists all pages with an attribute
> > [word:true]
> > > >
> > > >
> > > > Thanks
> > > > Melchior
> > > > --
> > > >
> > >
> >
>
> * It outputs the resulting section list in an updateable area of the
> current page.
This is very good - and as I've already indicated I use it all the
time as an alternative to the inbuilt SEARCH function.
I have 1 request...
Can it be extended to SORT the found pages before printing them, ie if
matches were found on pages A, B and C, could it sort the order of
the "finds" (I don't mind ascending or decending) so that they appear
in order please. Its probably a small change - but I don't understand
where it would go.
Thanks
G.