fixed docs + removed dead code

This commit is contained in:
dockes 2009-01-16 11:32:55 +00:00
parent 8a698c5c6b
commit c641cb9b57
7 changed files with 121 additions and 89 deletions

View File

@ -1,52 +1,74 @@
Recoll KIO slave Recoll KIO slave
================ ================
This is a small experiment with a recoll KIO slave An experiment with a recoll KIO slave.
It does not appear terribly useful as such, especially because I Caveat: I am only currently testing this with a production, but very
couldn't think of a way to get access to email documents from recent, version of KDE 4.1, and I don't intend to really support
Konqueror (especially those inside a multi-msg folder file, it's older versions. The most usable aspects work under KDE 4.0 though. As
better with maildir). The Recoll preview feature is actually quite a reference, my test system is an up to date (2009-01) Kubuntu 8.10.
useful in this case. But anyway, here it is...
Usage
=====
Depending on the protocol name used, the search results will be
returned either as HTML pages (looking quite like a normal Recoll
result list), or as directory entries.
The HTML mode only works with Konqueror, not Dolphin. The directory
mode is available with both browsers, and also application open dialog
(ie Kate).
The HTML mode is much more usable than the directory mode at this point
More detailed help/explanations can be found a document accessible
from the slave:
To try things out, after building and installing, enter "recoll:/" in
a Konqueror URL entry. Depending on the KDE version, this will bring
you either to an HTML search form, or to a directory listing, where
you should READ THE HELP FILE.
Building and installing: Building and installing:
======================= =======================
This began under KDE3 and might still be made to work, but I only The directory mode is only available with KDE 4.1 and later. This
built with KDE4 and cmake recently. Full functionality is only began under KDE3 and might still be made to work, but I only built
available with KDE 4.1 and later. with KDE4 and cmake recently.
The main Recoll installation shares its prefix with the KIO slave, The main Recoll installation shares its prefix with the KIO slave,
which needs to use the KDE one. This means that, if KDE lives in /usr, which needs to use the KDE one. This means that, if KDE lives in /usr,
Recoll must be configured with --prefix=/usr, not /usr/local. Else Recoll must be configured with --prefix=/usr, not /usr/local. Else
you'll have run-time problems, the slave will not be able to find the you'll have run-time problems, the slave will not be able to find the
recoll configuration. Recoll configuration.
A kind of recipe: Recipe:
- You need the KDE4 core devel packages and cmake installed - Make sure the KDE4 core devel packages and cmake are installed.
- Extract the recoll source, configure recoll with --prefix=/usr - Extract the Recoll source, configure recoll with --prefix=/usr
build and install recoll (or use another prefix if KDE lives elsewhere). (or wherever KDE lives), build and install Recoll.
- In the recoll source, go to kde/kioslave/recoll, then execute: - In the Recoll source, go to kde/kioslave/recoll, then build and
install the kio slave:
mkdir builddir mkdir builddir
cd builddir cd builddir
cmake .. -DCMAKE_INSTALL_PREFIX=/usr cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make make
sudo make install sudo make install
- You should have a look at where "make install" copies things, - You should have a look at where "make install" copies things,
because wrong targets are frequent. Especially, you should check because misconfigured distribution, generating wrong targets, are
that kio_recoll.so is copied to the right place, meaning among the frequent. Especially, you should check that kio_recoll.so is copied
output of "kde4-config --path module". As an additional check, to the right place, meaning among the output of "kde4-config --path
there should be many other kio_[xxx].so in there. Same for the module". As an additional check, there should be many other
protocol file, check that it's not alone in its directory (really, kio_[xxx].so in there. Same for the protocol file, check that it's
this sounds strange, but, to this point, I've seen more systems not alone in its directory (really, this sounds strange, but, to
with broken cmake/KDE configs than correct ones). this point, I've seen more systems with broken cmake/KDE configs
than correct ones).
You need to build/update the index with recollindex, the KIO slave You need to build/update the index with recollindex, the KIO slave
doesn't deal with it for now. doesn't deal with indexing for now.
Misc build problems: Misc build problems:
@ -63,15 +85,3 @@ Found no way to fix this. You need to edit the line and replace the
following error message: following error message:
make[2]: *** No rule to make target `/build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so', needed by `lib/kio_recoll.so'. Stop. make[2]: *** No rule to make target `/build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so', needed by `lib/kio_recoll.so'. Stop.
Usage
=====
You should then be able to enter "recoll:" in the konqueror URL
entry. Depending on the KDE version, this will bring you either to an
HTML search form, or to a directory listing, where you should read the
help file, which explains how to switch between the HTML and
directory-oriented interfaces.

View File

@ -56,7 +56,6 @@ ${rcltop}/query/plaintorich.cpp
${rcltop}/query/reslistpager.cpp ${rcltop}/query/reslistpager.cpp
${rcltop}/query/wasastringtoquery.cpp ${rcltop}/query/wasastringtoquery.cpp
${rcltop}/query/wasatorcl.cpp ${rcltop}/query/wasatorcl.cpp
${rcltop}/rcldb/pathhash.cpp
${rcltop}/rcldb/rcldb.cpp ${rcltop}/rcldb/rcldb.cpp
${rcltop}/rcldb/rcldoc.cpp ${rcltop}/rcldb/rcldoc.cpp
${rcltop}/rcldb/rclquery.cpp ${rcltop}/rcldb/rclquery.cpp

View File

@ -8,9 +8,7 @@
<h2>Recoll kio slave</h2> <h2>Recoll kio slave</h2>
<p>Use this module to perform Recoll searches from any program with <p>Use this module to perform Recoll searches from any program with
a KIO interface. <b>kio_recoll</b> is primarily a KIO interface.</p>
designed and tested with <b>konqueror</b>, and you will
undoubtedly get even more surprising effects with other tools.</p>
<p>The module can work in two modes:</p> <p>The module can work in two modes:</p>
<ul> <ul>
@ -25,6 +23,12 @@
ideas about improving kio_recoll, or observe an interesting and ideas about improving kio_recoll, or observe an interesting and
reproducible sequence, please <a href="mailto:jfd@recoll.org"> reproducible sequence, please <a href="mailto:jfd@recoll.org">
report it</a>.</p> report it</a>.</p>
<p><b>kio_recoll</b> is primarily
designed and tested with <b>konqueror</b>, and you will
undoubtedly get <i>even</i> more surprising effects with other tools.</p>
<p>The Html interface is currently much more usable. The directory
interface is extremely quirky.</p>
<p>The module is particularly unhelpful with search hits inside <p>The module is particularly unhelpful with search hits inside
email folders, which Konqueror has no way to access.</p> email folders, which Konqueror has no way to access.</p>
@ -40,27 +44,22 @@
<p>You normally enter this interface by entering "recoll:" or <p>You normally enter this interface by entering "recoll:" or
"recoll:/" in the Konqueror URL entry, and following the "search" "recoll:/" in the Konqueror URL entry, and following the "search"
link.<br> In most circumstances, entering a link like link. You can also directly enter "recoll:/search.html".<br>
In most circumstances, entering a link like
<a href="recoll:/john smith">recoll:/john smith</a> will also <a href="recoll:/john smith">recoll:/john smith</a> will also
yield an HTML result list.</p> yield an HTML result list.</p>
<p>Compared to QT Recoll, the nice point is that you can click or
drag/drop the icons to access the results in the standard desktop
way.</p>
<h3>File manager interface</h3> <h3>File manager interface</h3>
<p>Search results are returned as directory entries. No search
result details (samples, relevance etc.) are available, but this
interface allows multiple selections and copies, usage inside any
KDE open dialog, etc.</p>
<p>The <i>path</i> part of the URI is taken as a Recoll query <p>The <i>path</i> part of the URI is taken as a Recoll query
language string and executed. The results are displayed as language string and executed. The results are displayed as
directory entries.</p> directory entries.</p>
<p>To avoid swamping the interface with thousands of results, the
result count is limited to 100 by default. You can change this value
by setting the <code>kio_max_direntries</code> parameter in your recoll
configuration file (typically ~/.recoll/recoll.conf)</p>
<p>There are several ways to enter this interface:</p> <p>There are several ways to enter this interface:</p>
<ul> <ul>
<li>Using "recollf" as protocol name instead of "recoll". This is <li>Using "recollf" as protocol name instead of "recoll". This is
@ -72,15 +71,6 @@
recoll:/red apples ext:html/</a> recoll:/red apples ext:html/</a>
</blockquote> </blockquote>
</li> </li>
<li>Switching from the HTML interface in konqueror by clicking the
"Directory&nbsp;view" link at the top of the page. When doing
this, the directory content will be synchronized with the
current HTML result page. This offers a way to display results
in the file manager beyond the <code>kio_max_direntries</code>
limit. <em>In most cases, you will have to reload the file
manager page to obtain this synchronization</em>.</li>
<li>Users who will want to use the file manager view most of the <li>Users who will want to use the file manager view most of the
time can set the <code>RECOLL_KIO_ALWAYS_DIR</code> environment time can set the <code>RECOLL_KIO_ALWAYS_DIR</code> environment
variable or the <code>kio_always_dir</code> recoll.conf variable variable or the <code>kio_always_dir</code> recoll.conf variable
@ -88,6 +78,22 @@
through the search link in the top "recoll:" view.</li> through the search link in the top "recoll:" view.</li>
</ul> </ul>
<p>No search result details (samples, relevance etc.) are available,
but this interface allows multiple selections and copies, usage
inside any KDE open dialog, etc.</p>
<p>To avoid swamping the interface with thousands of results, the
result count is limited to 100 by default. You can change this value
by setting the <code>kio_max_direntries</code> parameter in your recoll
configuration file (typically ~/.recoll/recoll.conf)</p>
<p>Because of limitations in the current KIO slave usage, the actual
entry names are not those displayed but synthetic ones like
"recollResultxxx". This has unfortunate side-effects when
dragging/dropping the entries to some other application, or when
using an open dialog (the opened file doesn't have the correct path
to the original file).</p>
<p><a href="recoll:///search.html">Recoll Search</a></p> <p><a href="recoll:///search.html">Recoll Search</a></p>
</body> </body>

View File

@ -285,14 +285,8 @@ void RecollProtocol::listDir(const KUrl& url)
numentries = 100; numentries = 100;
} }
// If the html pager is set, begin display at the current page. This
// allows paging the dir display by switching between both modes
int first = 0;
if (m_pager.pageNumber() > 0) {
first = m_pager.pageNumber() * m_pager.pageSize();
}
vector<ResListEntry> page; vector<ResListEntry> page;
int pagelen = m_source->getSeqSlice(first, numentries, page); int pagelen = m_source->getSeqSlice(0, numentries, page);
if (pagelen < 0) { if (pagelen < 0) {
error(ERR_SLAVE_DEFINED, "Internal error"); error(ERR_SLAVE_DEFINED, "Internal error");
return; return;

View File

@ -98,7 +98,7 @@ const string& RecollKioPager::parFormat()
"<a href=\"%U\"><img src=\"%I\" align=\"left\"></a>" "<a href=\"%U\"><img src=\"%I\" align=\"left\"></a>"
"%R %S " "%R %S "
"<a href=\"" << escurl << "&cmd=pv&dn=%N\">Preview</a>&nbsp;&nbsp;" << "<a href=\"" << escurl << "&cmd=pv&dn=%N\">Preview</a>&nbsp;&nbsp;" <<
"<a href=\"%U\">Open</a><br>" << "<a href=\"%U\">Open</a> " <<
"<b>%T</b><br>" "<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp; <i>%U</i>&nbsp;&nbsp;%i<br>" "%M&nbsp;%D&nbsp;&nbsp; <i>%U</i>&nbsp;&nbsp;%i<br>"
"%A %K"; "%A %K";

View File

@ -257,8 +257,15 @@ void RecollProtocol::get(const KUrl& url)
goto out; goto out;
} }
} else if (ingest.isResult(&qd, &resnum)) { } else if (ingest.isResult(&qd, &resnum)) {
// Matched an url generated by konqueror out of a directory listing: // Url matched one generated by konqueror/Dolphin out of a
// ie: recoll:/some search string/recollResultxx // search directory listing: ie:
// recoll:/some search string/recollResultxx
//
// This happens when the user drags/drop the result to another
// app, or with the "open-with" right-click. Does not happen
// if the entry itself is clicked (the UDS_URL is apparently
// used in this case
//
// Redirect to the result document URL // Redirect to the result document URL
if (!syncSearch(qd)) { if (!syncSearch(qd)) {
return; return;

View File

@ -1,11 +1,20 @@
Recoll KIO Slave notes/todoes/etc.
Goal: access Recoll search from other applications.
We want to allow URLs like recoll:/?? to be used inside
Konqueror/Dolphin and open dialogs, to start a search with results
displayed/used inside the application.
Todoes Todoes
===== ======
Implementation notes: Implementation notes:
==================== ====================
- There would be two main ways to do this: - There are two main ways to do this:
- a-la kio_beagle, using listDir() to list entries pointing to the - a-la kio_beagle, using listDir() to list entries pointing to the
different operations or objects (help, status, search result different operations or objects (help, status, search result
entries, bookmarks, whatever...). The nice thing is that the entries, bookmarks, whatever...). The nice thing is that the
@ -14,16 +23,12 @@ Implementation notes:
KDE KDE
- Or a la strigi: all interactions are through html pages and get() - Or a la strigi: all interactions are through html pages and get()
operations. Looks less like a normal konqueror file-system operations. Much simpler, but does not allow file management
listing, and needs more html coding but all in all probably operations (except by drag/drop from the result list), and can't
simpler. use it inside other application's Open dialogs.
Recoll is currently doing both things on KDE4.1 (only html for KDE4.0).
Recoll is currently doing both things on KDE4.1 (only html for
KDE4.0). As far as I understand, the way to trigger a listdir is to
have a inode/directory default mime type in the protocol file, and
return inode/directory when appropriate in mimetype() (look at
kio_beagle). Some kde daemon needs to be restarted when doing this
(the protocol file is cached somewhere).
Virtual tree: Virtual tree:
============= =============
@ -38,17 +43,28 @@ recoll:/search.html
recoll:/some search string recoll:/some search string
recoll:/some search string/ recoll:/some search string/
We have a 'mode' determined by the protocol name:
recoll -> mixed
recollf -> file manager
- html mode: these redirect to recoll://search/query?q="some search string" - html mode: these redirect to recoll://search/query?q="some search string"
- file manager mode: do the search and display results. - file manager mode: do the search and display results.
- mixed mode: what mode is entered depends on ending / - mixed mode: what mode is entered depends on ending /
'mode' is determined by the protocol name:
recoll -> html
recollf -> file manager
recollm -> mixed
recoll://search/query?q=... recoll://search/query?q=...
html mode search html mode search
recoll:/some search string/recollResultxyz
xyz is the index in result list.
When generating a directory, with use bogus names for the result
entries (the displayed ones are from UDS_DISPLAY_NAME and are the real
names). When doing drag/drop or "open with" Konqueror/Dolphin builds
an url by concatenating the current directory name and the UDS_NAME,
instead of using UDS_TARGET_URL as when the entry is clicked. This
forces us to use identifying names including the result number, which
has many ennoying side effects (such as the target app not knowing the
real file path...
KIO notes: KIO notes:
========= =========