Project

General

Profile

Creating Search Indexes » History » Version 2

Version 1 (Luke Murphey, 06/11/2019 05:00 PM) → Version 2/3 (Luke Murphey, 06/15/2019 08:07 PM)

h1. Creating Search Indexes

The search functionality will not work until the search indexes are created. These take a long time to create and also take a lot of disk space (which is why I don't include them in the Docker image). See below for how to create the indexes.

h2. Creating them in the UI (for each work)

# Start by logging into the administration UI (i.e. http://127.0.0.1:8080/admin/). The username and password for the Docker image is admin/changeme.
# Select "Works"
# Select the work you want to create the search indexes for
# Click the action dropdown at the bottom of the page and select "Make search indexes"

The process make take a while, especially for large works.

!making_indexes.gif!

h2. Creating them from the command-line (and for all works)

You can also create the search indexes from the command-line. You can do this to create indexes for all works. This will take a great deal of time (like all night).

To do this, go to where the code for the project is stored and run the make_search_indexes command:

<pre>
python manage.py make_search_indexes -c
</pre>

h2. Copying existing indexes

You can copy in an existing set of indexes into an instance by placing the indexes directory into the app's var directory.

Precreated indexes are available here: https://www.dropbox.com/s/ypko9y5c3r9bi63/indexes.tar.gz?dl=0

For a Docker image, you can use the "cp" command to send the

h3. 1. Start the docker image and get the container ID

Start the docker image with the following command:

<pre>
docker run --rm -d -p 8080:8080/tcp textcritical:latest
</pre>

This command will output a long string which is the container ID; something like "b2749ed9678ec7b7de018ce6e2af56345fda626d7759c889d0bf8ba1ec91cc4b". You will need for the next step.

If the image is already running, then run the following to get the ID:

<pre>
docker ps
</pre>

This will output something like the following; in this case the ID is "b2749ed9678e":
<pre>
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2749ed9678e textcritical:latest "/usr/src/app/run_se…" 7 minutes ago Up 7 minutes 0.0.0.0:8080->8080/tcp dazzling_thompson
</pre>

h3. 2. Copy in the indexes directory

Run the "docker cp" command from the same directory where you extracted the indexes directory. Below is an example for a docker image with an ID of "b2749ed9678e" (substitute this for the ID you got from the previous step):

<pre>
docker cp indexes b2749ed9678e:/usr/src/app/var/indexes
</pre>

h3. 3. Verify the indexes exist

You can verify the indexes exist by running a shell against the host like this:

<pre>
docker exec -it b2749ed9678ec7b7de018ce6e2af56345fda626d7759c889d0bf8ba1ec91cc4b /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"
</pre>

Then run the following command:

<pre>
ls /usr/src/app/var/indexes
</pre>

This ought to output something like:

<pre>
MAIN_WRITELOCK MAIN_pu71dfydzgq68p18.seg _MAIN_3.toc
</pre>