From d8e08812f93af03df2bac765af591c7b115878f1 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 19 May 2024 19:49:15 +0800 Subject: [PATCH] update --- plugins/sphinx/class/sphinx_make.py | 20 +++++++++++++++++++- plugins/sphinx/install.sh | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/plugins/sphinx/class/sphinx_make.py b/plugins/sphinx/class/sphinx_make.py index 8abc11f00..e8a86f6fc 100644 --- a/plugins/sphinx/class/sphinx_make.py +++ b/plugins/sphinx/class/sphinx_make.py @@ -182,6 +182,23 @@ index {$DB_NAME}_{$TABLE_NAME} return conf +def makeSqlToSphinxTableIsHaveFulltext(pdb, db, table): + sql = "select COLUMN_NAME,DATA_TYPE from information_schema.COLUMNS where `TABLE_SCHEMA`='{}' and `TABLE_NAME` = '{}';" + sql = sql.format(db,table,) + cols = pdb.query(sql) + cols_len = len(cols) + + for x in range(cols_len): + data_type = cols[x]['DATA_TYPE'] + column_name = cols[x]['COLUMN_NAME'] + + if mw.inArray(['varchar'], data_type): + return True + + if mw.inArray(['text','mediumtext','tinytext','longtext'], data_type): + return True + + return False def makeSqlToSphinxAll(): filter_db = ['information_schema','performance_schema','sys','mysql'] @@ -221,7 +238,8 @@ def makeSqlToSphinxDb(pdb, db, table = []): if pkey_name == '': continue - conf += makeSphinxDbSource(pdb, db, table_name, pkey_name) + if makeSqlToSphinxTableIsHaveFulltext(pdb, db, table_name): + conf += makeSphinxDbSource(pdb, db, table_name, pkey_name) return conf def makeSqlToSphinxTable(pdb,db,table,pkey_name): diff --git a/plugins/sphinx/install.sh b/plugins/sphinx/install.sh index c9db0833a..231489a0d 100755 --- a/plugins/sphinx/install.sh +++ b/plugins/sphinx/install.sh @@ -13,8 +13,8 @@ install_tmp=${rootPath}/tmp/mw_install.pl # cd /www/server/mdserver-web && source bin/activate && python3 plugins/sphinx/index.py rebuild # cd /www/server/mdserver-web && source bin/activate && python3 plugins/sphinx/index.py db_to_sphinx -# /www/server/sphinx/bin/bin/indexer -c /www/server/sphinx/sphinx.conf --all --rotate -# /Users/midoks/Desktop/mwdev/server/sphinx/bin/bin/indexer /Users/midoks/Desktop/mwdev/server/sphinx/sphinx.conf --all --rotate +# /www/server/sphinx/bin/bin/indexer -c /www/server/sphinx/sphinx.conf 99cms_mc_comic --rotate +# /Users/midoks/Desktop/mwdev/server/sphinx/bin/bin/indexer /Users/midoks/Desktop/mwdev/server/sphinx/sphinx.conf 99cms_mc_comic --rotate bash ${rootPath}/scripts/getos.sh OSNAME=`cat ${rootPath}/data/osname.pl`