From 91d000642fdfc29dbba9c0ea2f2641593b720fac Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 20 Jun 2022 15:43:01 +0800 Subject: [PATCH] =?UTF-8?q?solr=E8=BD=AC=E7=A7=BB=E5=88=B0=20https://githu?= =?UTF-8?q?b.com/mw-plugin/solr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/solr/ico.png | Bin 978 -> 0 bytes plugins/solr/index.html | 23 - plugins/solr/index.py | 345 -------- plugins/solr/info.json | 16 - plugins/solr/init.d/solr.tpl | 78 -- plugins/solr/install.sh | 142 --- plugins/solr/js/solr.js | 196 ----- plugins/solr/script/full.py | 57 -- plugins/solr/script/incr.py | 4 - plugins/solr/tpl/db-data-config.xml | 22 - plugins/solr/tpl/managed-schema | 635 -------------- plugins/solr/tpl/realm.properties | 1 - plugins/solr/tpl/solr-jetty-context.xml | 17 - plugins/solr/tpl/solrconfig.xml | 1427 ------------------------------- plugins/solr/tpl/web.xml | 202 ----- 15 files changed, 3165 deletions(-) delete mode 100644 plugins/solr/ico.png delete mode 100755 plugins/solr/index.html delete mode 100755 plugins/solr/index.py delete mode 100755 plugins/solr/info.json delete mode 100644 plugins/solr/init.d/solr.tpl delete mode 100755 plugins/solr/install.sh delete mode 100755 plugins/solr/js/solr.js delete mode 100755 plugins/solr/script/full.py delete mode 100755 plugins/solr/script/incr.py delete mode 100644 plugins/solr/tpl/db-data-config.xml delete mode 100644 plugins/solr/tpl/managed-schema delete mode 100644 plugins/solr/tpl/realm.properties delete mode 100644 plugins/solr/tpl/solr-jetty-context.xml delete mode 100644 plugins/solr/tpl/solrconfig.xml delete mode 100644 plugins/solr/tpl/web.xml diff --git a/plugins/solr/ico.png b/plugins/solr/ico.png deleted file mode 100644 index 91f601fc3d1fc683009bdc56ce4190fa71007ab6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 978 zcmex=``2_j6xdp@o1cgOJMMZh|#U;cRDJhSy?$nc)58+NCy88 zFbHxms4y5XGb%AK2{JMZGX6ipPyuoxE6AyEz{bSF%Fe;aDZs$Q#K6kT!oQ504(bQCR2&vu_yk+ua7uiJTFYdA1u+i4a zFuK*7Lw+*jFXj5*9q0W&-$>YQV}-dE333Kl#_MymhTx zVy0MEaHjEM`wiuS!rAhAYu5f}Fg|hm;-{jTO^X$3@&v#5#><{GowwntWm@v;HBW+4 zw}o;2w3Sq9{aq|%bneg9S$;X^H}fYvKAwA6rt;?1msc!(b57k|8#({}yoeXqmI`!5 zYb~7_vD~0bxo1VCd5C&$)8~+*-!`3jb#kt+e{jjGbM;<|r}~n^rbPA>G1)9u{P)C< z|92cq?)#ri;>$|*)i3%gTbnC3b8Eax+IC-)J$jR)PiLOLHBm`xW9;9k^~%oDvMvAa z-t?Nr@Jj81dRpq%>A|zM&3$9^VtwXbXYYWQH*zoT5IK44_Sx4CXV!3QA6Jrm{ABq- z9)2OiSzA|a`L_KPTjA1r#&Wa$lV`kq7G^6dx_Zfl<5r*35~NELELJ4{i*De1CVl11 z>VU8OeM^@w*T1%S^1V~mQN?aTUvDfrr*UVi`4SJUm9oJHCEAnE-!hMjmR@eMW?lU{ z%$6j~q&4mnk z^^>>hZ -
-
-

服务

-

自启动

-

管理

-

日志

-

全量分页脚本

-

增量更新脚本

-

说明

-
-
-
-
-
- - - \ No newline at end of file diff --git a/plugins/solr/index.py b/plugins/solr/index.py deleted file mode 100755 index d8119c61a..000000000 --- a/plugins/solr/index.py +++ /dev/null @@ -1,345 +0,0 @@ -# coding: utf-8 - -import time -import random -import os -import json -import re -import sys - -sys.path.append(os.getcwd() + "/class/core") -import mw - -app_debug = False -if mw.isAppleSystem(): - app_debug = True - - -def getPluginName(): - return 'solr' - - -def getPluginDir(): - return mw.getPluginDir() + '/' + getPluginName() - - -def getServerDir(): - return mw.getServerDir() + '/' + getPluginName() - - -def getInitDFile(): - if app_debug: - return '/tmp/' + getPluginName() - return '/etc/init.d/' + getPluginName() - - -def getInitDTpl(): - return getPluginDir() + "/init.d/" + getPluginName() + ".tpl" - - -def getLog(): - return getServerDir() + "/server/logs/solr.log" - - -def getArgs(): - args = sys.argv[2:] - tmp = {} - args_len = len(args) - - if args_len == 1: - t = args[0].strip('{').strip('}') - t = t.split(':') - tmp[t[0]] = t[1] - elif args_len > 1: - for i in range(len(args)): - t = args[i].split(':') - tmp[t[0]] = t[1] - - return tmp - - -def checkArgs(data, ck=[]): - for i in range(len(ck)): - if not ck[i] in data: - return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!')) - return (True, mw.returnJson(True, 'ok')) - - -def status(): - pn = getPluginName() - data = mw.execShell( - "ps -ef|grep " + pn + " |grep -v grep | grep -v python | awk '{print $2}'") - if data[0] == '': - return 'stop' - return 'start' - - -def initDreplace(): - - file_tpl = getInitDTpl() - service_path = os.path.dirname(os.getcwd()) - - initD_path = getServerDir() + '/init.d' - if not os.path.exists(initD_path): - os.mkdir(initD_path) - - user = 'solr' - if mw.isAppleSystem(): - user = mw.execShell( - "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() - - file_bin = initD_path + '/' + getPluginName() - if not os.path.exists(file_bin): - content = mw.readFile(file_tpl) - content = content.replace('{$SERVER_PATH}', service_path) - content = content.replace('{$RUN_USER}', user) - mw.writeFile(file_bin, content) - mw.execShell('chmod +x ' + file_bin) - - file_py = initD_path + '/' + getPluginName() + '.py' - if not os.path.exists(file_py): - content = mw.readFile(getPluginDir() + '/script/full.py') - mw.writeFile(file_py, content) - mw.execShell('chmod +x ' + file_py) - - file_incr_py = initD_path + '/' + getPluginName() + '_incr.py' - if not os.path.exists(file_incr_py): - content = mw.readFile(getPluginDir() + '/script/incr.py') - mw.writeFile(file_incr_py, content) - mw.execShell('chmod +x ' + file_incr_py) - - # realm.properties - rp_path = getServerDir() + "/server/etc/realm.properties" - rp_path_tpl = getPluginDir() + "/tpl/realm.properties" - - # if not os.path.exists(rp_path): - content = mw.readFile(rp_path_tpl) - mw.writeFile(rp_path, content) - - # web.xml - web_xml = getServerDir() + "/server/solr-webapp/webapp/WEB-INF/web.xml" - web_xml_tpl = getPluginDir() + "/tpl/web.xml" - content = mw.readFile(web_xml_tpl) - mw.writeFile(web_xml, content) - - # solr-jetty-context.xml - solr_jetty_context_xml = getServerDir() + "/server/contexts/solr-jetty-context.xml" - solr_jetty_context_xml_tpl = getPluginDir() + "/tpl/solr-jetty-context.xml" - content = mw.readFile(solr_jetty_context_xml_tpl) - mw.writeFile(solr_jetty_context_xml, content) - - log_file = getLog() - if os.path.exists(log_file): - mw.writeFile(log_file, '') - - if not mw.isAppleSystem(): - mw.execShell('chown -R solr:solr ' + getServerDir()) - - return file_bin - - -def runShell(shell): - if mw.isAppleSystem(): - data = mw.execShell(shell) - else: - data = mw.execShell('su - solr -c "/bin/bash ' + shell + '"') - return data - - -def start(): - file = initDreplace() - data = runShell(file + ' start') - - if data[1] == '': - return 'ok' - return 'fail' - - -def stop(): - file = initDreplace() - data = runShell(file + ' stop') - if data[1] == '': - return 'ok' - return 'fail' - - -def restart(): - file = initDreplace() - data = runShell(file + ' restart') - if data[1] == '': - return 'ok' - return 'fail' - - -def reload(): - file = initDreplace() - data = runShell(file + ' reload') - - solr_log = getServerDir() + "/server/logs/solr.log" - mw.writeFile(solr_log, "") - - if data[1] == '': - return 'ok' - return 'fail' - - -def initdStatus(): - initd_bin = getInitDFile() - if os.path.exists(initd_bin): - return 'ok' - return 'fail' - - -def initdInstall(): - import shutil - - source_bin = initDreplace() - initd_bin = getInitDFile() - shutil.copyfile(source_bin, initd_bin) - mw.execShell('chmod +x ' + initd_bin) - - if not app_debug: - mw.execShell('chkconfig --add ' + getPluginName()) - return 'ok' - - -def initdUinstall(): - if not app_debug: - mw.execShell('chkconfig --del ' + getPluginName()) - - initd_bin = getInitDFile() - - if os.path.exists(initd_bin): - os.remove(initd_bin) - return 'ok' - - -def collectionList(): - path = getServerDir() + '/server/solr' - listDir = os.listdir(path) - data = {} - dlist = [] - for dirname in listDir: - dirpath = path + '/' + dirname - if not os.path.isdir(dirpath): - continue - if dirname == 'configsets': - continue - - tmp = {} - tmp['name'] = dirname - dlist.append(tmp) - data['list'] = dlist - data['ip'] = mw.getLocalIp() - data['port'] = '8983' - - content = mw.readFile(path + '/solr.xml') - - rep = "jetty.port:(.*)\}" - tmp = re.search(rep, content) - port = tmp.groups()[0] - data['port'] = port - - return mw.returnJson(True, 'OK', data) - - -def addCollection(): - args = getArgs() - data = checkArgs(args, ['name']) - if not data[0]: - return data[1] - - name = args['name'] - solr_bin = getServerDir() + "/bin/solr" - - retdata = runShell(solr_bin + ' create -c ' + name) - if retdata[1] != "": - return mw.returnJson(False, '添加失败!:' + retdata[1]) - - sc_path = getServerDir() + "/server/solr/" + name + "/conf/solrconfig.xml" - sc_path_tpl = getPluginDir() + "/tpl/solrconfig.xml" - content = mw.readFile(sc_path_tpl) - mw.writeFile(sc_path, content) - - sd_path = getServerDir() + "/server/solr/" + name + "/conf/db-data-config.xml" - sd_path_tpl = getPluginDir() + "/tpl/db-data-config.xml" - content = mw.readFile(sd_path_tpl) - mw.writeFile(sd_path, content) - - sd_path = getServerDir() + "/server/solr/" + name + "/conf/managed-schema" - sd_path_tpl = getPluginDir() + "/tpl/managed-schema" - content = mw.readFile(sd_path_tpl) - mw.writeFile(sd_path, content) - - return mw.returnJson(True, '添加成功!:' + retdata[0]) - - -def removeCollection(): - args = getArgs() - data = checkArgs(args, ['name']) - if not data[0]: - return data[1] - - name = args['name'] - solr_bin = getServerDir() + "/bin/solr" - - retdata = runShell(solr_bin + ' delete -c ' + name) - if retdata[1] != "": - return mw.returnJson(False, '删除失败!:' + retdata[1]) - return mw.returnJson(True, '删除成功!:' + retdata[0]) - - -def confFileCollection(): - args = getArgs() - data = checkArgs(args, ['name']) - if not data[0]: - return data[1] - - conf_file = getServerDir() + "/server/solr/" + \ - args['name'] + "/conf/" + args['conf_file'] - # print conf_file - return mw.returnJson(True, 'OK', {'path': conf_file}) - - -def scriptFull(): - return getServerDir() + "/init.d/solr.py" - - -def scriptIncr(): - return getServerDir() + "/init.d/solr_incr.py" - -# rsyncdReceive -if __name__ == "__main__": - func = sys.argv[1] - if func == 'status': - print(status()) - elif func == 'start': - print(start()) - elif func == 'stop': - print(stop()) - elif func == 'restart': - print(restart()) - elif func == 'reload': - print(reload()) - elif func == 'initd_status': - print(initdStatus()) - elif func == 'initd_install': - print(initdInstall()) - elif func == 'initd_uninstall': - print(initdUinstall()) - elif func == 'run_log': - print(getLog()) - elif func == 'collection_list': - print(collectionList()) - elif func == 'add_collection': - print(addCollection()) - elif func == 'remove_collection': - print(removeCollection()) - elif func == 'conf_file_collection': - print(confFileCollection()) - elif func == 'script_full': - print(scriptFull()) - elif func == 'script_incr': - print(scriptIncr()) - else: - print('error') diff --git a/plugins/solr/info.json b/plugins/solr/info.json deleted file mode 100755 index d16c932e0..000000000 --- a/plugins/solr/info.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id":10, - "title":"Solr", - "tip":"soft", - "name":"solr", - "type":"软件", - "ps":"一个独立的企业级搜索应用服务器", - "versions":"6.3.0", - "shell":"install.sh", - "checks":"server/solr", - "path": "server/solr", - "author":"midoks", - "home":"https://lucene.apache.org/solr/", - "date":"2019-08-01", - "pid":"2" -} \ No newline at end of file diff --git a/plugins/solr/init.d/solr.tpl b/plugins/solr/init.d/solr.tpl deleted file mode 100644 index c566c590e..000000000 --- a/plugins/solr/init.d/solr.tpl +++ /dev/null @@ -1,78 +0,0 @@ -#!/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. - -### BEGIN INIT INFO -# Provides: solr -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Description: Controls Apache Solr as a Service -### END INIT INFO - -# Example of a very simple *nix init script that delegates commands to the bin/solr script -# Typical usage is to do: -# -# cp bin/init.d/solr /etc/init.d/solr -# chmod 755 /etc/init.d/solr -# chown root:root /etc/init.d/solr -# update-rc.d solr defaults -# update-rc.d solr enable - -# Where you extracted the Solr distribution bundle -SOLR_INSTALL_DIR="{$SERVER_PATH}/solr" - -if [ ! -d "$SOLR_INSTALL_DIR" ]; then - echo "$SOLR_INSTALL_DIR not found! Please check the SOLR_INSTALL_DIR setting in your $0 script." - exit 1 -fi - -# Path to an include file that defines environment specific settings to override default -# variables used by the bin/solr script. It's highly recommended to define this script so -# that you can keep the Solr binary files separated from live files (pid, logs, index data, etc) -# see bin/solr.in.sh for an example -SOLR_ENV="{$SERVER_PATH}/solr/bin/solr.in.sh" - -if [ ! -f "$SOLR_ENV" ]; then - echo "$SOLR_ENV not found! Please check the SOLR_ENV setting in your $0 script." - exit 1 -fi - -# Specify the user to run Solr as; if not set, then Solr will run as root. -# Running Solr as root is not recommended for production environments -RUNAS="{$RUN_USER}" - -# verify the specified run as user exists -runas_uid="`id -u "$RUNAS"`" -if [ $? -ne 0 ]; then - echo "User $RUNAS not found! Please create the $RUNAS user before running this script." - exit 1 -fi - -case "$1" in - start|stop|restart|status) - SOLR_CMD="$1" - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit -esac - -if [ -n "$RUNAS" ]; then - su - "$RUNAS" -c "SOLR_INCLUDE=\"$SOLR_ENV\" \"$SOLR_INSTALL_DIR/bin/solr\" $SOLR_CMD" -else - SOLR_INCLUDE="$SOLR_ENV" "$SOLR_INSTALL_DIR/bin/solr" "$SOLR_CMD" -fi diff --git a/plugins/solr/install.sh b/plugins/solr/install.sh deleted file mode 100755 index c20ba753e..000000000 --- a/plugins/solr/install.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -curPath=`pwd` -rootPath=$(dirname "$curPath") -rootPath=$(dirname "$rootPath") -serverPath=$(dirname "$rootPath") -sysName=`uname` - -install_tmp=${rootPath}/tmp/mw_install.pl - - -sysName=`uname` -echo "use system: ${sysName}" - -if [ ${sysName} == "Darwin" ]; then - OSNAME='macos' -elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then - OSNAME='centos' -elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then - OSNAME='fedora' -elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then - OSNAME='debian' -elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then - OSNAME='ubuntu' -elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then - OSNAME='raspbian' -else - OSNAME='unknow' -fi - -CheckJAVA() -{ - which java > /dev/null - if [ $? -eq 0 ];then - echo 'java is exist' - else - echo 'java install...' - if [ "centos" == "$OSNAME" ] || [ "fedora" == "$OSNAME" ];then - yum install -y java - elif [ "ubuntu" == "$OSNAME" ] || [ "debian" == "$OSNAME" ] ;then - snap install openjdk - else - yum install -y java - fi - fi -} - - - -if id solr &> /dev/null ;then - echo "solr UID is `id -u solr`" - echo "solr Shell is `grep "^solr:" /etc/passwd |cut -d':' -f7 `" -else - if [ "$OSNAME" == "macos" ];then - echo "mac ..." - echo "groupadd solr" - echo "useradd -g solr -s /bin/bash solr" - else - groupadd solr - useradd -g solr -s /bin/bash solr - fi -fi - -action=$1 -version=$2 -Install_solr() -{ - CheckJAVA - echo '正在安装脚本文件...' > $install_tmp - mkdir -p $serverPath/solr - SOLR_DIR=${serverPath}/source/solr - mkdir -p $SOLR_DIR - if [ ! -f ${SOLR_DIR}/solr-${version}.tgz ];then - wget -O ${SOLR_DIR}/solr-${version}.tgz https://archive.apache.org/dist/lucene/solr/${version}/solr-${version}.tgz - fi - - mmseg_version=2.4.0 - if [ ! -f ${SOLR_DIR}/mmseg4j-${mmseg_version}.zip ];then - wget -O ${SOLR_DIR}/mmseg4j-${mmseg_version}.zip https://github.com/midoks/mdserver-web/releases/download/init/mmseg4j-${mmseg_version}.zip - fi - - if [ ! -d ${SOLR_DIR}/mmseg4j-${mmseg_version} ];then - cd ${SOLR_DIR}/ && unzip mmseg4j-${mmseg_version}.zip - fi - - if [ ! -f ${SOLR_DIR}/mysql-connector-java-5.1.48.jar ];then - wget -O ${SOLR_DIR}/mysql-connector-java-5.1.48.jar http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.48/mysql-connector-java-5.1.48.jar - fi - - if [ ! -f ${SOLR_DIR}/mysql-connector-java-8.0.17.jar ];then - wget -O ${SOLR_DIR}/mysql-connector-java-8.0.17.jar http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.17/mysql-connector-java-8.0.17.jar - fi - - if [ ! -d $serverPath/solr/bin ];then - cd ${SOLR_DIR} && tar -zxvf solr-${version}.tgz - cp -rf ${SOLR_DIR}/solr-${version}/* $serverPath/solr/ - if [ "$sysName" == "Darwin" ];then - echo "mac ... chown -R solr:solr $serverPath/solr" - else - chown -R solr:solr $serverPath/solr - fi - - fi - - if [ -d $serverPath/solr/dist ]; then - - if [ -f ${SOLR_DIR}/mysql-connector-java-5.1.48.jar ];then - cp -rf ${SOLR_DIR}/mysql-connector-java-5.1.48.jar $serverPath/solr/dist/ - fi - - if [ -f ${SOLR_DIR}/mysql-connector-java-8.0.17.jar ];then - cp -rf ${SOLR_DIR}/mysql-connector-java-8.0.17.jar $serverPath/solr/dist/ - fi - - if [ ! -f $serverPath/solr/dist/mmseg4j-core-1.10.0.jar ];then - cp -rf ${SOLR_DIR}/mmseg4j-2.4.0/mmseg4j-core-1.10.0.jar $serverPath/solr/dist/ - fi - - if [ ! -f $serverPath/solr/dist/mmseg4j-solr-2.4.0.jar ];then - cp -rf ${SOLR_DIR}/mmseg4j-2.4.0/mmseg4j-solr-2.4.0.jar $serverPath/solr/dist/ - fi - fi - - echo "$version" > $serverPath/solr/version.pl - echo '安装完成' > $install_tmp - -} - -Uninstall_solr() -{ - rm -rf $serverPath/solr - echo "卸载完成" > $install_tmp -} - - -if [ "${1}" == 'install' ];then - Install_solr $version -else - Uninstall_solr $version -fi diff --git a/plugins/solr/js/solr.js b/plugins/solr/js/solr.js deleted file mode 100755 index d1098c1fd..000000000 --- a/plugins/solr/js/solr.js +++ /dev/null @@ -1,196 +0,0 @@ -function str2Obj(str){ - var data = {}; - kv = str.split('&'); - for(i in kv){ - v = kv[i].split('='); - data[v[0]] = v[1]; - } - return data; -} - -function pPost(method,args,callback, title){ - - var _args = null; - if (typeof(args) == 'string'){ - _args = JSON.stringify(str2Obj(args)); - } else { - _args = JSON.stringify(args); - } - - var _title = '正在获取...'; - if (typeof(title) != 'undefined'){ - _title = title; - } - - var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 }); - $.post('/plugins/run', {name:'solr', func:method, args:_args}, function(data) { - layer.close(loadT); - if (!data.status){ - layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); - return; - } - - if(typeof(callback) == 'function'){ - callback(data); - } - },'json'); -} - - -function collectionManagement(){ - pPost('collection_list', '', function(data){ - var rdata = $.parseJSON(data.data); - if (!rdata.status){ - layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); - return; - } - - var list = rdata.data.list; - var con = ''; - con += '
'; - con += ''; - con += ''; - con += ''; - con += ''; - - con += ''; - - for (var i = 0; i < list.length; i++) { - con += ''+ - '' + - ' \ - '; - } - - con += ''; - con += '
collection操作(添加)'+ '|'+ 'WEB管理
' + list[i]['name']+'\ - 命令 \ - | 配置 \ - | 删除
'; - - $(".soft-man-con").html(con); - }); -} - - -function addCollection(){ - var loadOpen = layer.open({ - type: 1, - title: '添加Collection', - area: '400px', - content:"
\ -
\ - Collection\ -
\ - \ -
\ -
\ -
\ - \ -
\ -
", - }); - - $('#add_ok').click(function(){ - _data = {}; - _data['name'] = $('#name').val(); - var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); - pPost('add_collection', _data, function(data){ - var rdata = $.parseJSON(data.data); - layer.close(loadOpen); - layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); - setTimeout(function(){collectionManagement();},2000); - }); - }); -} - -function removeCollection(name){ - var loadOpen = layer.open({ - type: 1, - title: '删除用户', - area: '350px', - content:"
\ -
你要确认要删除collection["+ name + "]
\ -
\ - \ - \ -
\ -
" - }); - - $('#solr_del_close').click(function(){ - layer.close(loadOpen); - }); - - $('#solr_del_ok').click(function(){ - var _data = {}; - _data['name'] = name; - var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); - - _data = {}; - _data['name'] = name; - var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); - pPost('remove_collection', _data, function(data){ - var rdata = $.parseJSON(data.data); - layer.close(loadOpen); - layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); - setTimeout(function(){collectionManagement();},2000); - }); - }); -} - - -function confCollection(name){ - var html = ''; - html += ''; - html += ''; - html += ''; - - var loadOpen = layer.open({ - type: 1, - title: '['+name+']配置设置', - area: '240px', - content:'
'+html+'
' - }); -} - -function confFileCollection(name, conf_file){ - pPost('conf_file_collection', {'name':name, 'conf_file':conf_file}, function(data){ - var rdata = $.parseJSON(data.data); - if (rdata['status']){ - onlineEditFile(0, rdata['data']['path']); - } else { - layer.msg(rdata.msg,{icon:1,time:2000,shade: [0.3, '#000']}); - } - }); -} - - -function cmdCollection(name){ - var cmd = '
'; - cmd += ''; - cmd += ''; - cmd += ''; - cmd += ''; - cmd += ''; - cmd += '
增量更新curl "http://127.0.0.1:8983/solr/'+name+'/dataimport?command=delta-import&wt=json&clean=false&commit=true"
全量更新curl "http://127.0.0.1:8983/solr/'+name+'/dataimport?command=full-import&wt=json&clean=false&commit=true"
全量分页更新[计划任务]python /www/server/solr/init.d/solr.py
增量更新[计划任务]python /www/server/solr/init.d/solr_incr.py
默认端口:8983(可修改),默认IP为本地,可修改。
'; - - layer.open({ - type: 1, - title: '命令', - area: '750px', - content:cmd, - }); -} - -function pRead(){ - var readme = '
    '; - readme += '
  • 使用默认solr端口,如有需要自行修改
  • '; - readme += '
  • 如果开启防火墙,需要放行solr设置的端口,例如(8983)
  • '; - readme += '
  • 数据源设置好后,需要在managed-schema中同时设置
  • '; - readme += '
  • 优化索引段:curl --basic -u admin:admin "http://127.0.0.1:8983/solr/project/update?optimize=true&wt=json"
  • '; - readme += '
  • wiki说明
  • '; - readme += '
'; - - $('.soft-man-con').html(readme); -} \ No newline at end of file diff --git a/plugins/solr/script/full.py b/plugins/solr/script/full.py deleted file mode 100755 index 84b833804..000000000 --- a/plugins/solr/script/full.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import MySQLdb as mdb -import random -import sys -import subprocess -import time - -sys.path.append("/usr/local/lib/python2.7/site-packages") - -conn = mdb.connect(host='0.0.0.0', - port=3306, - user='xxx', - passwd='xxx', - db='xxx', - charset='utf8') -conn.autocommit(True) -cursor = conn.cursor() - - -sql = 'select id from xxx order by id desc limit 1' -r = cursor.execute(sql) - -count = 0 -for info in cursor.fetchall(): - count = info[0] -conn.close() - - -def execShell(cmdstring, cwd=None, timeout=None, shell=True): - - if shell: - cmdstring_list = cmdstring - else: - cmdstring_list = shlex.split(cmdstring) - if timeout: - end_time = datetime.datetime.now() + datetime.timedelta(seconds=timeout) - - sub = subprocess.Popen(cmdstring_list, cwd=cwd, stdin=subprocess.PIPE, - shell=shell, bufsize=4096, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - while sub.poll() is None: - time.sleep(0.1) - if timeout: - if end_time <= datetime.datetime.now(): - raise Exception("Timeout:%s" % cmdstring) - - return sub.communicate() - -length = 100 -for x in xrange(0, count / length + 1): - y = x * length - cmd = 'curl --basic -u admin:admin "http://127.0.0.1:8983/solr/sodht/dataimport?command=full-import&wt=json&clean=false&commit=true&length=' + \ - str(length) + '&offset=' + str(y) + '"' - print execShell(cmd) - time.sleep(0.3) diff --git a/plugins/solr/script/incr.py b/plugins/solr/script/incr.py deleted file mode 100755 index 90516f4dc..000000000 --- a/plugins/solr/script/incr.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -print 'hello world' diff --git a/plugins/solr/tpl/db-data-config.xml b/plugins/solr/tpl/db-data-config.xml deleted file mode 100644 index b4b4211b4..000000000 --- a/plugins/solr/tpl/db-data-config.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/solr/tpl/managed-schema b/plugins/solr/tpl/managed-schema deleted file mode 100644 index c0a31e57a..000000000 --- a/plugins/solr/tpl/managed-schema +++ /dev/null @@ -1,635 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/solr/tpl/realm.properties b/plugins/solr/tpl/realm.properties deleted file mode 100644 index 0747eaa19..000000000 --- a/plugins/solr/tpl/realm.properties +++ /dev/null @@ -1 +0,0 @@ -admin: admin, admin \ No newline at end of file diff --git a/plugins/solr/tpl/solr-jetty-context.xml b/plugins/solr/tpl/solr-jetty-context.xml deleted file mode 100644 index f31cd96e4..000000000 --- a/plugins/solr/tpl/solr-jetty-context.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - /solr-webapp/webapp - /etc/webdefault.xml - false - - - - - Test Reaml - /etc/realm.properties - - - - diff --git a/plugins/solr/tpl/solrconfig.xml b/plugins/solr/tpl/solrconfig.xml deleted file mode 100644 index c32122862..000000000 --- a/plugins/solr/tpl/solrconfig.xml +++ /dev/null @@ -1,1427 +0,0 @@ - - - - - - - - - 6.3.0 - - - - - - - - - - - - - - - - - - - - - - - - ${solr.data.dir:} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${solr.lock.type:native} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${solr.ulog.dir:} - ${solr.ulog.numVersionBuckets:65536} - - - - - ${solr.autoCommit.maxTime:15000} - false - - - - - - ${solr.autoSoftCommit.maxTime:-1} - - - - - - - - - - - - - - - - 1024 - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - 20 - - - 200 - - - - - - - - - - - - - - - - false - - - 2 - - - - - - - - - - - - - - - - - - - - - - - explicit - 10 - - - - - - - - - - - - - - - explicit - json - true - - - - - - - - explicit - - - - - - _text_ - - - - - - add-unknown-fields-to-the-schema - - - - - - - true - ignored_ - _text_ - - - - - - - - - text_general - - - - - - default - _text_ - solr.DirectSolrSpellChecker - - internal - - 0.5 - - 2 - - 1 - - 5 - - 4 - - 0.01 - - - - - - - - - - - db-data-config.xml - - - - - - - default - on - true - 10 - 5 - 5 - true - true - 10 - 5 - - - spellcheck - - - - - - - - - - true - - - tvComponent - - - - - - - - - - - - true - false - - - terms - - - - - - - - string - elevate.xml - - - - - - explicit - - - elevator - - - - - - - - - - - 100 - - - - - - - - 70 - - 0.5 - - [-\w ,/\n\"']{20,200} - - - - - - - ]]> - ]]> - - - - - - - - - - - - - - - - - - - - - - - - ,, - ,, - ,, - ,, - ,]]> - ]]> - - - - - - 10 - .,!? - - - - - - - WORD - - - en - US - - - - - - - - - - - - - - - - - [^\w-\.] - _ - - - - - - - yyyy-MM-dd'T'HH:mm:ss.SSSZ - yyyy-MM-dd'T'HH:mm:ss,SSSZ - yyyy-MM-dd'T'HH:mm:ss.SSS - yyyy-MM-dd'T'HH:mm:ss,SSS - yyyy-MM-dd'T'HH:mm:ssZ - yyyy-MM-dd'T'HH:mm:ss - yyyy-MM-dd'T'HH:mmZ - yyyy-MM-dd'T'HH:mm - yyyy-MM-dd HH:mm:ss.SSSZ - yyyy-MM-dd HH:mm:ss,SSSZ - yyyy-MM-dd HH:mm:ss.SSS - yyyy-MM-dd HH:mm:ss,SSS - yyyy-MM-dd HH:mm:ssZ - yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mmZ - yyyy-MM-dd HH:mm - yyyy-MM-dd - - - - strings - - java.lang.Boolean - booleans - - - java.util.Date - tdates - - - java.lang.Long - java.lang.Integer - tlongs - - - java.lang.Number - tdoubles - - - - - - - - - - - - - - - - - - - - - text/plain; charset=UTF-8 - - - - - ${velocity.template.base.dir:} - ${velocity.solr.resource.loader.enabled:true} - ${velocity.params.resource.loader.enabled:false} - - - - - 5 - - - - - - - - - - - - - - diff --git a/plugins/solr/tpl/web.xml b/plugins/solr/tpl/web.xml deleted file mode 100644 index 3e5299d22..000000000 --- a/plugins/solr/tpl/web.xml +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - SolrRequestFilter - org.apache.solr.servlet.SolrDispatchFilter - - - excludePatterns - /css/.+,/js/.+,/img/.+,/tpl/.+ - - - - - - SolrRequestFilter - /* - - - - LoadAdminUI - org.apache.solr.servlet.LoadAdminUiServlet - - - - - - RedirectOldAdminUI - org.apache.solr.servlet.RedirectServlet - - destination - ${context}/#/ - - - - - RedirectOldZookeeper - org.apache.solr.servlet.RedirectServlet - - destination - ${context}/admin/zookeeper - - - - - RedirectLogging - org.apache.solr.servlet.RedirectServlet - - destination - ${context}/#/~logging - - - - - SolrRestApi - org.restlet.ext.servlet.ServerServlet - - org.restlet.application - org.apache.solr.rest.SolrSchemaRestApi - - - - - RedirectOldAdminUI - /admin/ - - - RedirectOldAdminUI - /admin - - - RedirectOldZookeeper - /zookeeper.jsp - - - RedirectOldZookeeper - /zookeeper - - - RedirectLogging - /logging - - - - LoadAdminUI - /old.html - - - - LoadAdminUI - /index.html - - - - SolrRestApi - /schema/* - - - - .xsl - - application/xslt+xml - - - - index.html - - - - - - Disable TRACE - / - TRACE - - - - - - Enable everything but TRACE - / - TRACE - - - - - -