[sword-devel] fast searching support

Troy A. Griffitts sword-devel@crosswire.org
Mon, 14 Aug 2000 14:27:03 -0700

OK Joachim ;)

	I've added some basic search framework support and have optimized a few
search scenerios for the RawText driver (case insensitive, multiword
searches with a scope designated by a VerseKey).  You'll need the latest
CVS source to try it out.

There is a utility: sword/utilities/mkfastmod that will create the
search framework for a module if it is supported for the module type.

***	THIS IS A REFERENCE IMPLEMENTATION.  There are others much more
capable than myself (Trevor! :) ) that could do a much better job.  This
example should make the sword aspects of the job less mystic.

New/Augmented framework methods:

virtual ListKey &SWModule::Search(const char *istr, int searchType = 0,
int flags = 0, SWKey *scope = 0, bool *justCheckIfSupported = 0);

	justCheckIfSupported was added to allow one to see if THIS search
routine will perform the search.  This is not a check to see if the
search is ultimately supported (maybe by the base class).

virtual char SWModule::createSearchFramework();

	This will ask the module to build (or rebuild) any special search
framework that it supports.

virtual bool SWModule::hasSearchFramework();

	This allows one to check if the module driver supports a search

virtual bool SWModule::isSearchOptimallySupported(const char *istr, int
searchType, int flags, SWKey *scope);

	This allows one to check if the search will be handled in the most
optimized way (ie. if there is a search framework and it does not handle
this case, this will be false)

	Let me know if it works! :)  It compiles :)  j/k  Also, if there are
any questions by anyone wishing to build a real search framework, please


Joachim Ansorg wrote:
> Hi!
> My first article in this group!
> A really slow thing of SWORD is the searching part! In comparision with
> other programs it takes too long.
> Perhaps you noticed some months ago that Trevor Jenkins offered his help on
> this topic.
> But nothing happened.
> My question is: How do we get a more fast searching algorithm?
> -- Joachim