Created
July 26, 2023 08:52
-
-
Save KANATAKA/c87d586c41487fa507a2d0e667074660 to your computer and use it in GitHub Desktop.
Solr-8.11.2でデフォルトのKuromojiと併存できるようにKuromojiのパッケージ名を${PACKAGE}に変更するスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Solr-8.11.2でデフォルトのKuromojiと併存できるようにKuromojiのパッケージ名を${PACKAGE}に変更するスクリプト | |
PACKAGE="com/example/unidic" | |
echo "lucene/analysis/kuromoji/build.xmlのパッケージ名、ディレクトリ名を変更します" | |
sed -i.bak -e "s/org\.apache\.lucene/${PACKAGE//\//.}\.lucene/g" lucene/analysis/kuromoji/build.xml | |
sed -i.bak2 -e "s/org\/apache\/lucene/${PACKAGE//\//\\/}\/lucene/g" lucene/analysis/kuromoji/build.xml | |
echo "変更後のパッケージに合わせてディレクトリ構造を変更します" | |
for DIR in lucene/analysis/kuromoji/src/java lucene/analysis/kuromoji/src/resources; do | |
cd $DIR | |
mkdir -p ${PACKAGE} | |
mv org/apache/lucene/ ${PACKAGE} | |
rm -rf org | |
cd - | |
done | |
echo "ソースファイルのパッケージ宣言の変更を行います" | |
for DIR in lucene/analysis/kuromoji/src/java/${PACKAGE}/lucene/analysis/ja; do | |
cd $DIR | |
grep -rl 'org.apache.lucene.analysis.ja' ./* | xargs sed -i.bak -e "s/org.apache.lucene.analysis.ja/${PACKAGE//\//.}.lucene.analysis.ja/g" | |
cd - | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment