From 66b878922a3c48c8298eb59d23ebf3b2af4c2344 Mon Sep 17 00:00:00 2001 From: Macartur Sousa Date: Tue, 17 Mar 2015 15:09:07 -0300 Subject: [PATCH] Added ci/install_solr.sh, folder with solr_confs and updated .travis.yml --- .travis.yml | 10 ++++++---- ci/install_solr.sh | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ solr_confs/schema.xml | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ solr_confs/stopwords_en.txt | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 507 insertions(+), 4 deletions(-) create mode 100755 ci/install_solr.sh create mode 100644 solr_confs/schema.xml create mode 100644 solr_confs/stopwords_en.txt diff --git a/.travis.yml b/.travis.yml index 20a4b09..6e132cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,14 +10,16 @@ install: - pip install . - psql -c "CREATE USER colab WITH PASSWORD 'colab' CREATEDB;" -U postgres +before_script: + - colab-init-config > /etc/colab/settings.yaml + - colab-admin build_solr_schema > solr_confs/schema.xml + - SOLR_VERSION=4.10.3 SOLR_CONFS="solr_confs" exec `pwd`/ci/install_solr.sh + - colab-admin rebuild_index + script: - python setup.py test - flake8 colab -before_script: - - colab-admin build_solr_schema > schema.xml - - curl -sSL https://raw.githubusercontent.com/moliware/travis-solr/master/travis-solr.sh | SOLR_VERSION=4.10.2 bash - after_success: - coveralls - ci/build_rpm.sh diff --git a/ci/install_solr.sh b/ci/install_solr.sh new file mode 100755 index 0000000..9dfaddc --- /dev/null +++ b/ci/install_solr.sh @@ -0,0 +1,222 @@ +#!/usr/bin/env bash + +## Based on https://github.com/moliware/travis-solr/ (revision: 7975953) + +SOLR_PORT=${SOLR_PORT:-8983} + +download() { + FILE="$2.tgz" + if [ -f $FILE ]; + then + echo "File $FILE exists." + tar -zxf $FILE + else + echo "Downloading solr from $1..." + curl -O $1 + tar -zxf $FILE + fi + echo "Downloaded" +} + +is_solr_up(){ + http_code=`echo $(curl -s -o /dev/null -w "%{http_code}" "http://localhost:$SOLR_PORT/solr/admin/ping")` + return `test $http_code = "200"` +} + +wait_for_solr(){ + while ! is_solr_up; do + sleep 3 + done +} + +run() { + echo "Starting solr on port ${SOLR_PORT}..." + + cd $1/example + if [ $DEBUG ] + then + java -Djetty.port=$SOLR_PORT -jar start.jar & + else + java -Djetty.port=$SOLR_PORT -jar start.jar > /dev/null 2>&1 & + fi + wait_for_solr + cd ../../ + echo "Started" +} + +post_some_documents() { + java -Dtype=application/json -Durl=http://localhost:$SOLR_PORT/solr/update/json -jar $1/example/exampledocs/post.jar $2 +} + + +download_and_run() { + case $1 in + 3.5.0) + url="http://archive.apache.org/dist/lucene/solr/3.5.0/apache-solr-3.5.0.tgz" + dir_name="apache-solr-3.5.0" + dir_conf="conf/" + ;; + 3.6.0) + url="http://archive.apache.org/dist/lucene/solr/3.6.0/apache-solr-3.6.0.tgz" + dir_name="apache-solr-3.6.0" + dir_conf="conf/" + ;; + 3.6.1) + url="http://archive.apache.org/dist/lucene/solr/3.6.1/apache-solr-3.6.1.tgz" + dir_name="apache-solr-3.6.1" + dir_conf="conf/" + ;; + 3.6.2) + url="http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz" + dir_name="apache-solr-3.6.2" + dir_conf="conf/" + ;; + 4.0.0) + url="http://archive.apache.org/dist/lucene/solr/4.0.0/apache-solr-4.0.0.tgz" + dir_name="apache-solr-4.0.0" + dir_conf="collection1/conf/" + ;; + 4.1.0) + url="http://archive.apache.org/dist/lucene/solr/4.1.0/solr-4.1.0.tgz" + dir_name="solr-4.1.0" + dir_conf="collection1/conf/" + ;; + 4.2.0) + url="http://archive.apache.org/dist/lucene/solr/4.2.0/solr-4.2.0.tgz" + dir_name="solr-4.2.0" + dir_conf="collection1/conf/" + ;; + 4.2.1) + url="http://archive.apache.org/dist/lucene/solr/4.2.1/solr-4.2.1.tgz" + dir_name="solr-4.2.1" + dir_conf="collection1/conf/" + ;; + 4.3.1) + url="http://archive.apache.org/dist/lucene/solr/4.3.1/solr-4.3.1.tgz" + dir_name="solr-4.3.1" + dir_conf="collection1/conf/" + ;; + 4.4.0) + url="http://archive.apache.org/dist/lucene/solr/4.4.0/solr-4.4.0.tgz" + dir_name="solr-4.4.0" + dir_conf="collection1/conf/" + ;; + 4.5.0) + url="http://archive.apache.org/dist/lucene/solr/4.5.0/solr-4.5.0.tgz" + dir_name="solr-4.5.0" + dir_conf="collection1/conf/" + ;; + 4.5.1) + url="http://archive.apache.org/dist/lucene/solr/4.5.1/solr-4.5.1.tgz" + dir_name="solr-4.5.1" + dir_conf="collection1/conf/" + ;; + 4.6.0) + url="http://archive.apache.org/dist/lucene/solr/4.6.0/solr-4.6.0.tgz" + dir_name="solr-4.6.0" + dir_conf="collection1/conf/" + ;; + 4.6.1) + url="http://archive.apache.org/dist/lucene/solr/4.6.1/solr-4.6.1.tgz" + dir_name="solr-4.6.1" + dir_conf="collection1/conf/" + ;; + 4.7.0) + url="http://archive.apache.org/dist/lucene/solr/4.7.0/solr-4.7.0.tgz" + dir_name="solr-4.7.0" + dir_conf="collection1/conf/" + ;; + 4.7.1) + url="http://archive.apache.org/dist/lucene/solr/4.7.1/solr-4.7.1.tgz" + dir_name="solr-4.7.1" + dir_conf="collection1/conf/" + ;; + 4.7.2) + url="http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz" + dir_name="solr-4.7.2" + dir_conf="collection1/conf/" + ;; + 4.8.0) + url="http://archive.apache.org/dist/lucene/solr/4.8.0/solr-4.8.0.tgz" + dir_name="solr-4.8.0" + dir_conf="collection1/conf/" + ;; + 4.8.1) + url="http://archive.apache.org/dist/lucene/solr/4.8.1/solr-4.8.1.tgz" + dir_name="solr-4.8.1" + dir_conf="collection1/conf/" + ;; + 4.9.0) + url="http://archive.apache.org/dist/lucene/solr/4.9.0/solr-4.9.0.tgz" + dir_name="solr-4.9.0" + dir_conf="collection1/conf/" + ;; + 4.9.1) + url="http://archive.apache.org/dist/lucene/solr/4.9.1/solr-4.9.1.tgz" + dir_name="solr-4.9.1" + dir_conf="collection1/conf/" + ;; + 4.10.0) + url="http://archive.apache.org/dist/lucene/solr/4.10.0/solr-4.10.0.tgz" + dir_name="solr-4.10.0" + dir_conf="collection1/conf/" + ;; + 4.10.1) + url="http://archive.apache.org/dist/lucene/solr/4.10.1/solr-4.10.1.tgz" + dir_name="solr-4.10.1" + dir_conf="collection1/conf/" + ;; + 4.10.2) + url="http://archive.apache.org/dist/lucene/solr/4.10.2/solr-4.10.2.tgz" + dir_name="solr-4.10.2" + dir_conf="collection1/conf/" + ;; + 4.10.3) + url="http://archive.apache.org/dist/lucene/solr/4.10.3/solr-4.10.3.tgz" + dir_name="solr-4.10.3" + dir_conf="collection1/conf/" + ;; + esac + + download $url $dir_name + + # copies custom configurations + for file in $SOLR_CONFS + do + if [ -d $file ] + then + cp $file/* $dir_name/example/solr/$dir_conf + echo "Copied directory $file into solr conf directory." + elif [ -f $file ] + then + cp $file $dir_name/example/solr/$dir_conf + echo "Copied $file into solr conf directory." + fi + done + + # Run solr + run $dir_name $SOLR_PORT + + # Post documents + if [ -z "$SOLR_DOCS" ] + then + echo "$SOLR_DOCS not defined, skipping initial indexing" + else + echo "Indexing $SOLR_DOCS" + post_some_documents $dir_name $SOLR_DOCS + fi +} + +check_version() { + case $1 in + 3.5.0|3.6.0|3.6.1|3.6.2|4.0.0|4.1.0|4.2.0|4.2.1|4.3.1|4.4.0|4.5.0|4.5.1|4.6.0|4.6.1|4.7.0|4.7.1|4.7.2|4.8.0|4.8.1|4.9.0|4.9.1|4.10.0|4.10.1|4.10.2|4.10.3);; + *) + echo "Sorry, $1 is not supported or not valid version." + exit 1 + ;; + esac +} + + +check_version $SOLR_VERSION +download_and_run $SOLR_VERSION diff --git a/solr_confs/schema.xml b/solr_confs/schema.xml new file mode 100644 index 0000000..f98a50a --- /dev/null +++ b/solr_confs/schema.xml @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + text + + + + + diff --git a/solr_confs/stopwords_en.txt b/solr_confs/stopwords_en.txt new file mode 100644 index 0000000..2c164c0 --- /dev/null +++ b/solr_confs/stopwords_en.txt @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# a couple of test stopwords to test that the words are really being +# configured from this file: +stopworda +stopwordb + +# Standard english stop words taken from Lucene's StopAnalyzer +a +an +and +are +as +at +be +but +by +for +if +in +into +is +it +no +not +of +on +or +such +that +the +their +then +there +these +they +this +to +was +will +with -- libgit2 0.21.2