Creating Search Indexes » History » Version 3
  Luke Murphey, 03/09/2020 07:14 PM 
  
| 1 | 1 | Luke Murphey | h1. Creating Search Indexes  | 
|---|---|---|---|
| 2 | 1 | Luke Murphey | |
| 3 | 1 | Luke Murphey | 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.  | 
| 4 | 1 | Luke Murphey | |
| 5 | 1 | Luke Murphey | h2. Creating them in the UI (for each work)  | 
| 6 | 1 | Luke Murphey | |
| 7 | 1 | Luke Murphey | # 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.  | 
| 8 | 1 | Luke Murphey | # Select "Works"  | 
| 9 | 1 | Luke Murphey | # Select the work you want to create the search indexes for  | 
| 10 | 1 | Luke Murphey | # Click the action dropdown at the bottom of the page and select "Make search indexes"  | 
| 11 | 1 | Luke Murphey | |
| 12 | 1 | Luke Murphey | The process make take a while, especially for large works.  | 
| 13 | 1 | Luke Murphey | |
| 14 | 1 | Luke Murphey | !making_indexes.gif!  | 
| 15 | 1 | Luke Murphey | |
| 16 | 1 | Luke Murphey | h2. Creating them from the command-line (and for all works)  | 
| 17 | 1 | Luke Murphey | |
| 18 | 1 | Luke Murphey | 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).  | 
| 19 | 1 | Luke Murphey | |
| 20 | 1 | Luke Murphey | To do this, go to where the code for the project is stored and run the make_search_indexes command:  | 
| 21 | 1 | Luke Murphey | |
| 22 | 1 | Luke Murphey | <pre>  | 
| 23 | 1 | Luke Murphey | python manage.py make_search_indexes -c  | 
| 24 | 1 | Luke Murphey | </pre>  | 
| 25 | 2 | Luke Murphey | |
| 26 | 2 | Luke Murphey | h2. Copying existing indexes  | 
| 27 | 2 | Luke Murphey | |
| 28 | 2 | Luke Murphey | You can copy in an existing set of indexes into an instance by placing the indexes directory into the app's var directory.  | 
| 29 | 2 | Luke Murphey | |
| 30 | 2 | Luke Murphey | Precreated indexes are available here: https://www.dropbox.com/s/ypko9y5c3r9bi63/indexes.tar.gz?dl=0  | 
| 31 | 2 | Luke Murphey | |
| 32 | 2 | Luke Murphey | For a Docker image, you can use the "cp" command to send the  | 
| 33 | 2 | Luke Murphey | |
| 34 | 2 | Luke Murphey | h3. 1. Start the docker image and get the container ID  | 
| 35 | 2 | Luke Murphey | |
| 36 | 2 | Luke Murphey | Start the docker image with the following command:  | 
| 37 | 2 | Luke Murphey | |
| 38 | 2 | Luke Murphey | <pre>  | 
| 39 | 2 | Luke Murphey | docker run --rm -d -p 8080:8080/tcp textcritical:latest  | 
| 40 | 2 | Luke Murphey | </pre>  | 
| 41 | 2 | Luke Murphey | |
| 42 | 2 | Luke Murphey | This command will output a long string which is the container ID; something like "b2749ed9678ec7b7de018ce6e2af56345fda626d7759c889d0bf8ba1ec91cc4b". You will need for the next step.  | 
| 43 | 2 | Luke Murphey | |
| 44 | 2 | Luke Murphey | If the image is already running, then run the following to get the ID:  | 
| 45 | 2 | Luke Murphey | |
| 46 | 2 | Luke Murphey | <pre>  | 
| 47 | 2 | Luke Murphey | docker ps  | 
| 48 | 2 | Luke Murphey | </pre>  | 
| 49 | 2 | Luke Murphey | |
| 50 | 2 | Luke Murphey | This will output something like the following; in this case the ID is "b2749ed9678e":  | 
| 51 | 2 | Luke Murphey | <pre>  | 
| 52 | 2 | Luke Murphey | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  | 
| 53 | 2 | Luke Murphey | b2749ed9678e textcritical:latest "/usr/src/app/run_se…" 7 minutes ago Up 7 minutes 0.0.0.0:8080->8080/tcp dazzling_thompson  | 
| 54 | 2 | Luke Murphey | </pre>  | 
| 55 | 2 | Luke Murphey | |
| 56 | 2 | Luke Murphey | h3. 2. Copy in the indexes directory  | 
| 57 | 2 | Luke Murphey | |
| 58 | 2 | Luke Murphey | 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):  | 
| 59 | 2 | Luke Murphey | |
| 60 | 2 | Luke Murphey | <pre>  | 
| 61 | 2 | Luke Murphey | docker cp indexes b2749ed9678e:/usr/src/app/var/indexes  | 
| 62 | 2 | Luke Murphey | </pre>  | 
| 63 | 2 | Luke Murphey | |
| 64 | 2 | Luke Murphey | h3. 3. Verify the indexes exist  | 
| 65 | 2 | Luke Murphey | |
| 66 | 2 | Luke Murphey | You can verify the indexes exist by running a shell against the host like this:  | 
| 67 | 2 | Luke Murphey | |
| 68 | 2 | Luke Murphey | <pre>  | 
| 69 | 2 | Luke Murphey | docker exec -it b2749ed9678ec7b7de018ce6e2af56345fda626d7759c889d0bf8ba1ec91cc4b /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"  | 
| 70 | 2 | Luke Murphey | </pre>  | 
| 71 | 2 | Luke Murphey | |
| 72 | 2 | Luke Murphey | Then run the following command:  | 
| 73 | 2 | Luke Murphey | |
| 74 | 2 | Luke Murphey | <pre>  | 
| 75 | 2 | Luke Murphey | ls /usr/src/app/var/indexes  | 
| 76 | 2 | Luke Murphey | </pre>  | 
| 77 | 2 | Luke Murphey | |
| 78 | 2 | Luke Murphey | This ought to output something like:  | 
| 79 | 2 | Luke Murphey | |
| 80 | 2 | Luke Murphey | <pre>  | 
| 81 | 2 | Luke Murphey | MAIN_WRITELOCK MAIN_pu71dfydzgq68p18.seg _MAIN_3.toc  | 
| 82 | 2 | Luke Murphey | </pre>  | 
| 83 | 3 | Luke Murphey | |
| 84 | 3 | Luke Murphey | h2. Creating indexes in Docker  | 
| 85 | 3 | Luke Murphey | |
| 86 | 3 | Luke Murphey | You can create the indexes in Docker by doing the following (assuming your container is named pedantic_goldberg):  | 
| 87 | 3 | Luke Murphey | |
| 88 | 3 | Luke Murphey | <pre>  | 
| 89 | 3 | Luke Murphey | screen -S reindex  | 
| 90 | 3 | Luke Murphey | docker exec -it pedantic_goldberg python manage.py make_search_indexes -c  | 
| 91 | 3 | Luke Murphey | </pre>  | 
| 92 | 3 | Luke Murphey | Type Ctrl-a + Ctrl-d to detach from the session. You can list out the sessions with this:  | 
| 93 | 3 | Luke Murphey | |
| 94 | 3 | Luke Murphey | <pre>  | 
| 95 | 3 | Luke Murphey | screen -ls  | 
| 96 | 3 | Luke Murphey | </pre>  |