[25903] | 1 | README file for Greenstone 3's Solr extension
|
---|
| 2 |
|
---|
[25906] | 3 | CONTENTS OF THIS README
|
---|
| 4 | - Acquiring and setting up the Solr extension
|
---|
| 5 | - Importing and (re-)building a collection with the Solr extension
|
---|
| 6 | - Running the Solr extension's Jetty server on its own
|
---|
| 7 | - Some handy manual commands
|
---|
| 8 | - Adding new Java classes into the Solr extension
|
---|
[25903] | 9 |
|
---|
[25906] | 10 |
|
---|
[25903] | 11 | ACQUIRING AND SETTING UP THE SOLR EXTENSION
|
---|
| 12 |
|
---|
| 13 | 1. SVN checkout the solr extension's src folder into the top-level ext directory of a Greenstone 3 installation, under the name "solr":
|
---|
| 14 |
|
---|
| 15 | $gs3> cd ext
|
---|
| 16 | $gs3> svn co http://svn.greenstone.org/gs3-extensions/solr/trunk/src solr
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | 2. Next run the add-service ant target in the solr extension just checked out, which will set up solr (the del-service will undo this setup if ever required):
|
---|
| 20 |
|
---|
| 21 | $gs3/ext> cd solr
|
---|
| 22 | $gs3/ext/solr> ant add-service
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | 3. Compile up Greenstone 3's core java classes:
|
---|
| 26 | $gs3/ext/solr> cd ../..
|
---|
| 27 | $gs3> ant compile-core
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | 4. Edit a collection's etc/collectionConfig.xml, setting the search type to be solr.
|
---|
| 31 |
|
---|
| 32 | For instance, copy the (Lucene) Demo Collection of Greenstone 3 and rename it as Solr-JDBM-Demo. Next open etc/collectionConfig.xml in an editor and adjust the display name of the collection and then set the search type attribute to solr:
|
---|
| 33 |
|
---|
| 34 | <displayItem assigned="true" lang="en" name="name">Solr/JDBM demo</displayItem>
|
---|
| 35 | <search type="solr">
|
---|
| 36 |
|
---|
| 37 | (For this collection, references to dc.Title in the collectionConfig.xml may need to become or be preceded by references to dls.Title)
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | 5. Run the GS3 tomcat server:
|
---|
| 41 | $gs3> ant start
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | IMPORTING AND (RE-)BUILDING A COLLECTION WITH SOLR
|
---|
| 45 |
|
---|
| 46 | 1. Set up the environment for Greenstone 3 first to have access to the build-scripts:
|
---|
| 47 |
|
---|
| 48 | $gs3> gs3-setup.bat / source gs3-setup.sh
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | 2a. For a full rebuild (without -removeold it defaults to -removeold anyway), with or without the Greenstone3 server already running, type the following commands in succession:
|
---|
| 52 |
|
---|
| 53 | $gs3> perl -S import.pl [-removeold] -site localsite <colname>
|
---|
| 54 | $gs3> perl -S buildcol.pl [-removeold] -site localsite <colname>
|
---|
| 55 | $gs3> perl -S activate.pl [-removeold] -site localsite <colname>
|
---|
| 56 |
|
---|
| 57 | OR:
|
---|
| 58 | $gs3> perl -S import.pl [-removeold] -site localsite <colname>
|
---|
| 59 | $gs3> perl -S buildcol.pl [-removeold] -activate -site localsite <colname>
|
---|
| 60 |
|
---|
| 61 | OR:
|
---|
| 62 | $gs3> perl -S full-rebuild.pl -site localsite <colname>
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | 2b. For an incremental rebuild, with or without the Greenstone3 server already running:
|
---|
| 66 |
|
---|
| 67 | $gs3> perl -S incremental-import.pl -site localsite <colname>
|
---|
| 68 | $gs3> perl -S incremental-buildcol.pl -site localsite <colname>
|
---|
| 69 | $gs3> perl -S activate.pl -incremental -site localsite <colname>
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | 3. Preview the collection. If the Greenstone3 server wasn't already running, start it up first:
|
---|
| 73 | $gs3> ant start
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | RUNNING THE SOLR EXTENSION'S JETTY SERVER ON ITS OWN
|
---|
| 77 |
|
---|
| 78 | 1. Ensure the environment for Greenstone 3 is set up, if you haven't already done so:
|
---|
| 79 |
|
---|
| 80 | $gs3> gs3-setup.bat / source gs3-setup.sh
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | 2. Run the solr extension's jetty server in standalone mode:
|
---|
| 84 | $gs3> perl -S run_solr_server.pl start <optional stopkey>
|
---|
| 85 |
|
---|
| 86 | If no stopkey is provided, it will use "standalone-greenstone-solr" as the stopkey.
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | 3. Visit the running Solr Admin page for an index of your solr collection, which tends to be run on port 8983:
|
---|
| 90 | http://localhost:8983/solr/localsite-<colname>-<indexlevel>/admin
|
---|
| 91 |
|
---|
| 92 | E.g. http://localhost:8983/solr/localsite-solr-jdbm-demo-didx/admin
|
---|
| 93 | http://localhost:8983/solr/localsite-solr-jdbm-demo-sidx/admin
|
---|
| 94 |
|
---|
| 95 | Search each index on the default search pattern (*:*) to see if documents have been properly indexed by solr.
|
---|
| 96 | If that's the case, an XML listing the number of responses and some metadata for each should be returned.
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | 4. To stop a running solr extension jetty server that has been run in standalone mode. Pass in the same stopkey if you provided any during start:
|
---|
| 100 |
|
---|
| 101 | $gs3> perl -S run_solr_server.pl stop <optional stopkey>
|
---|
| 102 |
|
---|
| 103 |
|
---|
[25906] | 104 | SOME HANDY MANUAL COMMANDS
|
---|
[25903] | 105 | The commands expressed below are for Linux, adjust them for Windows
|
---|
| 106 |
|
---|
| 107 | 1. Manually running the solr extension's jetty server:
|
---|
| 108 |
|
---|
| 109 | $gs3/ext/solr> java -Dsolr.solr.home=`pwd` -jar lib/java/solr-jetty-server.jar
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | 2. Manually getting this running solr server to index a greenstone collection's documents:
|
---|
| 113 |
|
---|
| 114 | $gs3/ext/solr> java -Dsolr.solr.home=`pwd` -Durl=http://localhost:8983/solr/localsite-solr-jdbm-demo-didx/update -jar lib/java/solr-post.jar
|
---|
| 115 |
|
---|
| 116 | The above posts the solr-jdbm-demo collection's didx (document-level) index folder contents to Solr to be ingested.
|
---|
| 117 |
|
---|
[25906] | 118 |
|
---|
| 119 | ADDING NEW JAVA CLASSES INTO THE SOLR EXTENSION
|
---|
| 120 |
|
---|
| 121 | 1. Create the Java classes and place them into their package within the ext/solr location.
|
---|
| 122 |
|
---|
| 123 | 2. Adjust the ant build file in the solr extension (ext/solr/build.xml) to take these java source files into account during the setup process that takes place when the ant target 'add-service' is executed. The relevant portions of this build.xml file are likely to be the property 'java-service-files' and the property 'java-util-files'.
|
---|
| 124 |
|
---|