Youtube guide for solr set up: Link (Updated)
This guide walks you through downloading, installing, and running Apache Solr. It also covers setting up your Java environment (JAVA_HOME) and provides a quick comparison between Solr and a traditional relational database.
-
Open Command Prompt:
PressWindows + R, typecmd, and press Enter. -
Check Java Version
java -version
Example Output:
java version "17.0.2" 2022-01-18 LTS Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86) Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)
java -versionExample Output:
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8)
OpenJDK 64-Bit Server VM (build 17.0.2+8, mixed mode)where javaExample Output:
C:\Program Files\Eclipse Adoptium\jdk-21.0.6.7-hotspot\bin\java.exe- Copy everything before
\bin\java.exe, for example:
C:\Program Files\Eclipse Adoptium\jdk-21.0.6.7-hotspotset JAVA_HOME=C:\Program Files\Eclipse Adoptium\jdk-21.0.6.7-hotspotsetx JAVA_HOME "C:\Program Files\Eclipse Adoptium\jdk-21.0.6.7-hotspot" /MVerify:
echo %JAVA_HOME%Example Output:
C:\Program Files\Eclipse Adoptium\jdk-21.0.6.7-hotspotexport JAVA_HOME="/c/Program Files/Eclipse Adoptium/jdk-21.0.6.7-hotspot"nano ~/.bashrcAdd this line:
export JAVA_HOME="/c/Program Files/Eclipse Adoptium/jdk-21.0.6.7-hotspot"Load new settings:
source ~/.bashrcset JAVA_HOME=C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot- For current user (no admin needed):
setx JAVA_HOME "C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot"
- For all users (admin required):
(Remove quotes if they cause issues.)
setx JAVA_HOME "C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot" /M
-
Download Apache Solr
- Get the latest binary from:
https://solr.apache.org/downloads.html (e.g.,solr-9.8.1.zip).
- Get the latest binary from:
-
Extract Solr into the Repo Folder
- Move the downloaded
solr-9.8.1.zipinto your repo folder (e.g.,SC4021-Information-Retrieval-main/). - Extract it there, resulting in:
SC4021-Information-Retrieval-main/ ├── solr-9.8.1/ ├── other_repo_files/ ├── searchEngine/ └── ...
- Move the downloaded
- Run the
start.pyfile in the Repo: - cmd print out:
JAVA_HOME is set to: ...\Programs\Eclipse Adoptium\jdk-21.0.6.7-hotspot Starting Solr in the background... Solr started with PID: 21132 To access Solr: http://localhost:8983/solr/
- Open
http://localhost:8983/solr/in a browser to confirm it’s running. - If no data upon startup, run the
importJson.pyfile in the Repo: - cmd print out:
JSON data imported successfully! Changes committed successfully!
- If error of no core: run the
create_core()function in the start.py then proceed to Step 4 to import the data to the core