Skip to content

Conversation

@nchiasson-dgi
Copy link
Contributor

@nchiasson-dgi nchiasson-dgi commented Sep 8, 2025

Summary by CodeRabbit

  • Chores
    • Updated Solr configuration to allow a property-based override for the OCR highlighting library location (adds a default fallback). Only the library location mechanism changed; matching behavior and highlighting remain unchanged. No user action required.

@nchiasson-dgi nchiasson-dgi added the patch Backwards compatible bug fixes. label Sep 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 8, 2025

Walkthrough

Updated Solr OCR highlighting library path in conf/solrconfig_extra.xml to use a property-based directory: changed the <lib> dir from a fixed /var/solr/data/contrib/ocrhighlighting/lib to ${solr.hocr.plugin.path:/opt/solr_extra_lib/ocrhighlighting/lib}; the regex .*\.jar is unchanged.

Changes

Cohort / File(s) Summary
Solr OCR highlighting lib path
conf/solrconfig_extra.xml
Replaced hardcoded <lib dir="/var/solr/data/contrib/ocrhighlighting/lib" ... /> with property-based <lib dir="${solr.hocr.plugin.path:/opt/solr_extra_lib/ocrhighlighting/lib}" regex=".*\.jar" /> to allow overriding the path while preserving the default and keeping the regex unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I hopped through configs, light on my feet,
Moved jars to a new burrow, tidy and neat.
From /var’s old warren to a property-wrapped lair,
OCR glimmers find pathways handled with care.
Thump-thump—deploy! My whiskers agree:
Highlighting’s home now lives where it should be. 🐇✨

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2608000 and b4e5caa.

📒 Files selected for processing (1)
  • conf/solrconfig_extra.xml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • conf/solrconfig_extra.xml
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ocrhighlighting-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
conf/solrconfig_extra.xml (2)

249-249: Avoid hard-coding the lib path; make it configurable via a system property.

Using a property allows per-environment overrides without code changes.

-<lib dir="/opt/solr_extra_lib/ocrhighlighting/lib" regex=".*\.jar" />
+<lib dir="${solr.ocrhighlighting.lib:/opt/solr_extra_lib/ocrhighlighting/lib}" regex=".*\.jar" />

243-249: Consider using sharedLib if multiple cores need the same OCR plugin.

If several cores use OCR highlighting, centralize jars via solr.xml sharedLib to avoid per-core duplication and classpath drift.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 74cc91e and 2608000.

📒 Files selected for processing (1)
  • conf/solrconfig_extra.xml (1 hunks)

-->
<searchComponent name="tvComponent" class="solr.TermVectorComponent"/>
<lib dir="/var/solr/data/contrib/ocrhighlighting/lib" regex=".*\.jar" />
<lib dir="/opt/solr_extra_lib/ocrhighlighting/lib" regex=".*\.jar" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify jars are present and the class is loadable from the new location.

Ensure the directory exists in the runtime environment, Solr can read it, and it contains the plugin jars exporting solrocr.OcrHighlightComponent.


🏁 Script executed:

#!/bin/bash
set -euo pipefail
DIR="/opt/solr_extra_lib/ocrhighlighting/lib"

# 1) Directory and permissions
test -d "$DIR" || { echo "Missing: $DIR"; exit 1; }
ls -l "$DIR"

# 2) Jars present
fd -e jar . "$DIR" | tee /tmp/ocr_jars.txt
test -s /tmp/ocr_jars.txt || { echo "No jars found in $DIR"; exit 1; }

# 3) Try to locate the component class in jars
while read -r J; do
  if jar tf "$J" | rg -q '^solrocr/OcrHighlightComponent.class$'; then
    echo "Found solrocr.OcrHighlightComponent in: $J"
    FOUND=1
  fi
done < /tmp/ocr_jars.txt
test "${FOUND:-0}" = 1 || { echo "Component class not found in provided jars"; exit 1; }

# 4) Optional: ensure Solr user can read
id solr >/dev/null 2>&1 && sudo -n -u solr bash -c "test -r '$DIR' && echo 'solr user can read $DIR'"

Length of output: 48


Ensure OCR lib directory exists and is populated
/opt/solr_extra_lib/ocrhighlighting/lib was not found in the environment (script reported “Missing: /opt/solr_extra_lib/ocrhighlighting/lib”). Solr will fail to load solrocr.OcrHighlightComponent unless that directory is created, populated with the plugin JARs, and readable by the Solr user.

🤖 Prompt for AI Agents
In conf/solrconfig_extra.xml around line 249, the <lib> entry points to
/opt/solr_extra_lib/ocrhighlighting/lib which is missing; create that directory,
place the required OCR plugin JARs (including the solrocr OcrHighlightComponent
JAR and its dependencies) into it, set ownership to the Solr user and
permissions to be readable by Solr (eg. chown solr:solr and chmod 0755 for dirs,
0644 for jars), and verify the files are present and readable before restarting
Solr so the component can be loaded.

@nchiasson-dgi nchiasson-dgi merged commit 9e957c8 into main Sep 8, 2025
3 checks passed
@nchiasson-dgi nchiasson-dgi deleted the fix/ocrhighlighting-path branch September 8, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Backwards compatible bug fixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants