Screenshot here:
https://plus.google.com/103097156557482112329/posts/HnobiCY4QJR
Usage in a nutshell:
- easy_install Whoosh
- enable plugin "bigdash.py" (implementation itself is in leofts.py,
but it's enough to enable bigdash.py).
- Open the .leo files you want to search
- alt-x global-search
And in the dashboard line entry:
- Do "fts init" to create the index from all the open files
- Do "f foo bar" to search for terms "foo" and "bar".
(quick ref in the attached screenshot)
Note that you don't need to have the .leo files open anymore.
What's missing:
- Clicking on links won't select the position if the .leo file is not
open. That can be arranged later on (e.g. clicking on UNL could open
the file and navigate to the tree position).
- Source snippets won't be shown (as you can see from screenshots). It
will be quite easy to show snippets with highlighted items FOR LEO
FILES THAT ARE OPEN, I just didn't have time to do it now. Index
doesn't have full contents of the nodes (by design, I could store
those in the index too but I don't want to bloat it up), but yet I
have some ambitions to show also snippets from closed leo files. For
this, I need a lightweight xml file parsing and some way to drill into
@thin files and parse sentinels as well,
> --
> You received this message because you are subscribed to the Google Groups "leo-editor" group.
> To post to this group, send email to leo-e...@googlegroups.com.
> To unsubscribe from this group, send email to leo-editor+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
>
If the .leo file is not already open, it doesn't work in current
implementation. So you have to open the file manually, then click on
the link.
Not happening for me. The link is blue underlined, clicking it doesn't
change focus.
Missing a plugin?
Depending on what you mean by focus.... it moves the selection in the
tree, but does not change the UI focus to the right window or tab.
> Not happening for me. The link is blue underlined, clicking it doesn't
> change focus.
>
> Missing a plugin?
Can you paste what you see on terminal where you launched leo, when
clicking on the links?
I tend to work with many Leo files opened in the tabbed interface.
When I click a result link, I was expecting to be transported to that node.
I now see that if I click the file tab for a result link, the found
node is focused.
I certainly _expected_ to be taken to the result (as a 'nav' result does),
do you prefer staying on the result window and selecting the file?
Also, the filename is in small italics after some context lines, if focus
is to stay on the search pane, I'd prefer the filename be larger, near
the result link.
I guess the advantage of this scheme is the ability to first click several
results, close the search, go from tab to tab, each one focused per the search.
Maybe that makes more sense than what I expect ...
Thanks,
Kent
> No, this is a missing feature. I want it to select the tab so you see
> where the focus was moved.
c.bringToFront() brings the tab to front, I think. Something I hacked
in a while ago.
Cheers -Terry
>> No, this is a missing feature. I want it to select the tab so you see
>> where the focus was moved.
>
> c.bringToFront() brings the tab to front, I think. Something I hacked
> in a while ago.
Indeed it does, thanks for the feature :).
global-search now brings focus to right tab + node when clicking on a
link in search hits.
> How do you feel about importing leoGlobals at the top level now?
I'm ok with that, but don't really see a benefit. Code that can run
without Leo running is more valuable than one that can't, so I'd
rather leave it out for quick tests in the future.
I see. I was confused by this import::
try:
import leo.plugins.leofts as leofts
except ImportError:
leofts = None
But we can't use this approach for leoGlobals: g.toUnicode is
necessary for Python 3k. It might be best to copy g.toUnicode (and
its several helpers) into bigdash.py.
Edward
Typically g is availabe at top level (see set_leo), so it's no problem leaving it like it is
On 9.3.2012 18:40 Edward K. Ream wrote:
https://plus.google.com/103097156557482112329/posts/HiHcvLgiJ47
Documents that are not open will (still) just show heading and UNL.
As it is, it can't treat foo(bar) as tokens "foo" and "bar", which is
not great for scanning throught sources.
Next task 2: provide "text completion" from the words in full text search index.
You don't have Whoosh installed, install it:
easy_install Whoosh
> --
> You received this message because you are subscribed to the Google Groups "leo-editor" group.
> To post to this group, send email to leo-e...@googlegroups.com.
> To unsubscribe from this group, send email to leo-editor+...@googlegroups.com.
easy_install Whoosh
Both work for whoosh; setuptools is a devil i know ;).
I don't see much benefit in tracking the debate, since both seem to do the job. Use the one that is easier to install on your computer (setuptools, I.e. easy_install seemed easier to install on windows machine)
FWIW, I just installed pip for the first time on windows today.
Relatively straightforward if one has curl or wget in path:
{{{
curl http://python-distribute.org/distribute_setup.py | python
curl --insecure
https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
copy con c:\pip.bat
%pythonhome%\Scripts\pip.exe %* [ctrl-Z]
}}}
--
-matt
> but yet I
> have some ambitions to show also snippets from closed leo files. For
> this, I need a lightweight xml file parsing and some way to drill into
> @thin files and parse sentinels as well,
leosax is lightweight xml file parsing, but doesn't drill into @thin
files etc.
./leo/external/leosax.py
Thought there was a demo .leo file for it, but don't see it now.
Cheers -Terry
> Thought there was a demo .leo file for it, but don't see it now.
This example probably suffices :-)
http://groups.google.com/group/leo-editor/browse_thread/thread/cf5ab54f29a6c128
Cheers -Terry
> I have now pushed full text search support (operational already, not
> as nice as it will be later on ;-).
That's very cool, nice job. I wonder if we can write a headless
nullgui based spider to regularly index all the .leo files it can find.
Cheers -Terry
Cheers -Terry
If leoBridge didn't work all of Leo's unit tests would fail when run
externally. See:
@file leoDynamicTest.py-->main & helpers (leoDynamicTest.py)
EKR