Skip to content

Instantly share code, notes, and snippets.

@yaoyi
Last active December 21, 2015 12:08
Show Gist options
  • Save yaoyi/6303422 to your computer and use it in GitHub Desktop.
Save yaoyi/6303422 to your computer and use it in GitHub Desktop.
#! /bin/sh
mkdir .tmp
cd .tmp
wget https://github.com/sunspot/sunspot/archive/v2.0.0.pre.130115.zip
unzip v2.0.0.pre.130115.zip
mv sunspot-2.0.0.pre.130115 sunspot
wget http://mmseg4j.googlecode.com/files/mmseg4j-1.8.5.zip
unzip mmseg4j-1.8.5.zip -d mmseg4j
cp -r sunspot/sunspot_solr/solr ../sunspot_solr_mmseg4j
mkdir -p WEB-INF/lib
cp mmseg4j/dist/*-1.8.5.jar WEB-INF/lib
cp -r mmseg4j/data/ ../sunspot_solr_mmseg4j/solr/mmseg4j_dict/
sed -ie 's,class="solr.StandardTokenizerFactory",class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" dicPath="mmseg4j_dict",g' ../sunspot_solr_mmseg4j/solr/conf/schema.xml
zip -u ../sunspot_solr_mmseg4j/webapps/solr.war WEB-INF/lib/*.jar
cd ..
rm -rf .tmp
echo "******************"
echo "** install done **"
echo "******************"
echo "cd sunspot_solr_mmseg4j and run 'java -jar start.jar' to start jetty"
echo "visit http://localhost:8983/solr/ to verify result"
@yaoyi
Copy link
Author

yaoyi commented Aug 22, 2013

执行install.sh脚本以后,会在本目录下面生成一个sunspot_solr_mmseg4j目录,这里包括了jetty,solr的war文件,以及mmseg4j的集成,你只需要执行java -jar start.jar,就能够启动一个solr server。

启动后,用浏览器访问 http://localhost:8983/solr/admin/analysis.jsp

选择Field为type,输入text。 Field value (Index) 输入 “研究生研究生命科学” 。点击Analyze,如果输出“研究|生|研究|生命|科学”,就说明mmseg4j + sunspot 已经build成功。

from https://github.com/quake/sunspot_chinese_example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment