[jsword-devel] Indexing modules programmatically
DM Smith
dmsmith at crosswire.org
Tue Mar 28 04:54:13 MST 2017
Chris,
See if o.c.j.bridge.BookInstaller suits your needs for building indexes. The bridge package was written to provide command line interface to basic things and serve as examples of how to write such in JSword. You’ll have to create your own shell script for it. For an example of such see: http://www.crosswire.org/bibledesktop/stable/BibleDesktop.sh
Note that indexes may need to be rebuilt if the program’s version of Java is updated wrt to Unicode or if Lucene is upgraded.
-Dsword.home and -Djsword.home should work just fine, but they have to be set properly. Here is how JSword should resolve:
sword.home is the location for installing modules.
jsword.home is the location for storing JSword specific values.
If these are not set JSword will do it’s best to find JSword’s home based on the architecture of the machine. We’ll refer to this as JSWORD_HOME regardless of how it is set.
These two properties are used to set values in o.c.j.book.sword.SwordBookPath. It builds an array of module locations containing current directory, SWORD_HOME (if set), other standard locations, and finally user specified locations (via setAugmentPath). Of those, they need to have the expected mods.d and modules folder to be included. The default install directory is the first writeable among those. There’s additional logic for a new install that doesn’t have any location with mods.d and modules.
The current working directory ‘.’ is supposed to be the location of the executable, but typically it is some odd place which doesn’t have mods.d and modules. So while it is first, it typically doesn’t have an impact.
The upshot is that sword.home when it points to a folder having mods.d and modules will be the first location for looking for modules.
JSWORD_HOME is actually based upon CWProject.setHome. The first argument is expected to be jsword.home, but it doesn’t have to be. It can be step.home or any other value. If that system property exists and points to a writeable folder, it will be used as JSWORD_HOME.
Under JSWORD_HOME, the lucene folder will hold the indexes for the module. It doesn’t have to pre-exist indexing, being created as needed.
Hope this helps,
DM
> On Mar 27, 2017, at 5:41 PM, Martin Denham <mjdenham at gmail.com> wrote:
>
> And Bible's indexes are here: http://crosswire.org/and-bible/indices/v1/ <http://crosswire.org/and-bible/indices/v1/>
>
> They are generated using JSword on JDK 7.
>
> Martin
>
> On 27 March 2017 at 21:58, Chris Burrell <chris at burrell.me.uk <mailto:chris at burrell.me.uk>> wrote:
> Apologies for the many emails. I don't think the -Dsword.home -Djsword.home variables will work sadly. This looks first at ~/.sword and then after that adds in the the system property values. So it seems it looks at both directories, rather than just the one?
>
> Any ideas on how to only look at a specific directory?
> Chris
>
>
> On 27 March 2017 at 21:12, Chris Burrell <chris at burrell.me.uk <mailto:chris at burrell.me.uk>> wrote:
> -sorry sent too soon.
>
> ... though presumably I will have to unzip the files.
>
> If someone knows whether the Crosswire server stores the indexes, please let me know.
> Chris
>
>
> On 27 March 2017 at 21:11, Chris Burrell <chris at burrell.me.uk <mailto:chris at burrell.me.uk>> wrote:
> Hi
>
> In fact, forget the first part, I seem to have that, though I have to install the modules in the .sword folder for this to work. I just found this: sword.home which should hopefully mean I can index stuff without installing the modules, though presumably I will have to rebul
>
> Thanks
> Chris
>
>
> On 27 March 2017 at 21:01, Chris Burrell <chris at burrell.me.uk <mailto:chris at burrell.me.uk>> wrote:
> Hi all
>
> Does anyone have a packaged 'indexer' that can be run from the command line. I'm assuming it's not too hard to build, though from recollection this is an async process, etc and so if someone just had some code they have already as a packager that would be great.
>
> Also, do you know if the crosswire server stores some JSword indexes for the modules they host? If so, that could save a bit of time...
>
> Let me know. Thanks
> Chris
>
>
>
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org <mailto:jsword-devel at crosswire.org>
> http://www.crosswire.org/mailman/listinfo/jsword-devel <http://www.crosswire.org/mailman/listinfo/jsword-devel>
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20170328/6447ab5d/attachment.html>
More information about the jsword-devel
mailing list