Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alan@karma:cust cat create_cust.sh
- #!/bin/sh
- # solrconfig.xml schema.xml
- # stopword_num.txt stopword_org.txt stopword_phone.txt
- # synonym_addr.txt synonym_ind.txt synonym_org.txt
- KSCF=search.cust
- for arg
- do
- case "$arg" in
- config)
- echo Posting solrconfig.xml
- $TEST curl http://localhost:8983/solr/resource/$KSCF/solrconfig.xml --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
- ;;
- schema)
- echo Posting the schema file:
- $TEST curl http://localhost:8983/solr/resource/$KSCF/schema.xml --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'
- ;;
- stop*)
- echo Posting the stopword files:
- for stop in num org phone
- do
- $TEST curl http://localhost:8983/solr/resource/$KSCF/stopword_$stop.txt --data-binary \
- stopword_$stop.txt -H 'Content-type:text/xml; charset=utf-8'
- done
- ;;
- syn*)
- echo Posting the synonym files:
- for syn in addr ind org
- do
- $TEST curl http://localhost:8983/solr/resource/$KSCF/synonym_$syn.txt --data-binary \
- synonym_$syn.txt -H 'Content-type:text/xml; charset=utf-8'
- done
- ;;
- create|make|core|index)
- # specific to Datastaxe Enterprise Search:
- # http://www.datastax.com/docs/datastax_enterprise3.1/solutions/dse_search_upload
- CREATE_URL="http://localhost:8983/solr/admin/cores?action=CREATE&name=$KSCF"
- echo "Creating core index $KSCF"
- $TEST curl -s -X POST $CREATE_URL
- echo "Created core index $KSCF"
- ;;
- reindex|rebuild)
- # http://www.datastax.com/docs/datastax_enterprise3.1/solutions/dse_search_reload_core#partial-reindex
- UPDATE_URL="http://localhost:8983/solr/admin/cores?action=RELOAD&name=$KSCF&reindex=true&deleteAll=false"
- echo "Recreating core index $KSCF"
- $TEST curl -s -X POST $UPDATE_URL
- echo "Recreated core index $KSCF"
- ;;
- startover)
- # http://www.datastax.com/docs/datastax_enterprise3.1/solutions/dse_search_reload_core#partial-reindex
- UPDATE_URL="http://localhost:8983/solr/admin/cores?action=RELOAD&name=$KSCF&reindex=true&deleteAll=true"
- echo "Recreating core index $KSCF"
- $TEST curl -s -X POST $UPDATE_URL
- echo "Recreated core index $KSCF"
- ;;
- esac
- done
- alan@karma:cust TEST=echo create*sh config schema syn create |grep curl
- curl http://localhost:8983/solr/resource/search.cust/solrconfig.xml --data-binary @solrconfig.xml -H Content-type:text/xml; charset=utf-8
- curl http://localhost:8983/solr/resource/search.cust/schema.xml --data-binary @schema.xml -H Content-type:text/xml; charset=utf-8
- curl http://localhost:8983/solr/resource/search.cust/synonym_addr.txt --data-binary synonym_addr.txt -H Content-type:text/xml; charset=utf-8
- curl http://localhost:8983/solr/resource/search.cust/synonym_ind.txt --data-binary synonym_ind.txt -H Content-type:text/xml; charset=utf-8
- curl http://localhost:8983/solr/resource/search.cust/synonym_org.txt --data-binary synonym_org.txt -H Content-type:text/xml; charset=utf-8
- curl -s -X POST http://localhost:8983/solr/admin/cores?action=CREATE&name=search.cust
- alan@karma:cust
- alan@karma:cust cat post.sh
- #!/bin/sh
- # 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.
- REPLACE=${REPLACE:-false}
- RPL="?replacefields=$REPLACE"
- KSCF=search.cust
- URL=http://localhost:8983/solr/$KSCF/update$RPL
- for f
- do
- echo Posting file $f to $URL
- $TEST curl $URL --data-binary @$f -H 'Content-type:application/xml'
- echo
- done
- alan@karma:cust TEST=echo post.sh joe6.xml
- Posting file joe6.xml to http://localhost:8983/solr/search.cust/update?replacefields=false
- curl http://localhost:8983/solr/search.cust/update?replacefields=false --data-binary @joe6.xml -H Content-type:application/xml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement