for chinese
This commit is contained in:
parent
e07a02fe32
commit
1233156a64
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ sphinx.conf
|
||||
*.p2p
|
||||
downloads.json
|
||||
node.exe
|
||||
.idea
|
||||
|
||||
/dist
|
||||
/temp
|
||||
|
@ -37,10 +37,13 @@ const writeSphinxConfig = async (rootPath, dbPath, params = {}) => {
|
||||
{
|
||||
type = rt
|
||||
path = ${dbPath}/database/torrents
|
||||
|
||||
|
||||
min_prefix_len = 3
|
||||
expand_keywords = 1
|
||||
|
||||
charset_type = utf-8
|
||||
charset_table = 0..9, A..Z->a..z, a..z, U+4E00..U+9FFF->U+4E00..U+9FFF, U+3400..U+4DBF->U+3400..U+4DBF, U+20000..U+2A6DF->U+20000..U+2A6DF, U+2A700..U+2B73F->U+2A700..U+2B73F, U+2B740..U+2B81F->U+2B740..U+2B81F, U+2B820..U+2CEAF->U+2B820..U+2CEAF, U+2CEB0..U+2EBEF->U+2CEB0..U+2EBEF
|
||||
|
||||
|
||||
rt_attr_string = hash
|
||||
rt_attr_string = name
|
||||
rt_field = nameIndex
|
||||
@ -59,7 +62,7 @@ const writeSphinxConfig = async (rootPath, dbPath, params = {}) => {
|
||||
rt_attr_uint = good
|
||||
rt_attr_uint = bad
|
||||
rt_attr_json = info
|
||||
|
||||
|
||||
stored_only_fields = ipv4
|
||||
}
|
||||
|
||||
@ -67,7 +70,11 @@ const writeSphinxConfig = async (rootPath, dbPath, params = {}) => {
|
||||
{
|
||||
type = rt
|
||||
path = ${dbPath}/database/files
|
||||
|
||||
|
||||
charset_type = utf-8
|
||||
charset_table = 0..9, A..Z->a..z, a..z, U+4E00..U+9FFF->U+4E00..U+9FFF, U+3400..U+4DBF->U+3400..U+4DBF, U+20000..U+2A6DF->U+20000..U+2A6DF, U+2A700..U+2B73F->U+2A700..U+2B73F, U+2B740..U+2B81F->U+2B740..U+2B81F, U+2B820..U+2CEAF->U+2B820..U+2CEAF, U+2CEB0..U+2EBEF->U+2CEB0..U+2EBEF
|
||||
|
||||
|
||||
rt_field = path
|
||||
rt_attr_string = hash
|
||||
rt_field = size
|
||||
@ -80,7 +87,7 @@ const writeSphinxConfig = async (rootPath, dbPath, params = {}) => {
|
||||
{
|
||||
type = rt
|
||||
path = ${dbPath}/database/version
|
||||
|
||||
|
||||
rt_attr_uint = version
|
||||
rt_field = versionIndex
|
||||
}
|
||||
@ -89,7 +96,7 @@ const writeSphinxConfig = async (rootPath, dbPath, params = {}) => {
|
||||
{
|
||||
type = rt
|
||||
path = ${dbPath}/database/store
|
||||
|
||||
|
||||
rt_field = storeIndex
|
||||
rt_attr_json = data
|
||||
rt_attr_string = hash
|
||||
@ -269,7 +276,7 @@ module.exports = async (callback, dataDirectory, onClose, params = {}) => {
|
||||
sphinx.version = manticoreVersion[1];
|
||||
logT('sphinx', 'sphinx version', sphinx.version);
|
||||
}
|
||||
|
||||
|
||||
if(windowsEncodingFix && data.includes('failed to parse config file'))
|
||||
{
|
||||
logT('sphinx', 'encoding rewrite failed, forcing restart of application to fix that problem')
|
||||
@ -305,12 +312,12 @@ module.exports = async (callback, dataDirectory, onClose, params = {}) => {
|
||||
sphinx.onClose = onFinish
|
||||
if(replaceFinish)
|
||||
sphinx.replaceOnClose = true // sometime we don't want to call default callback
|
||||
|
||||
if (!sphinx.isExternal)
|
||||
|
||||
if (!sphinx.isExternal)
|
||||
{
|
||||
logT('sphinx', `stoping with sphinx stopwait`);
|
||||
exec(`"${sphinxPath}" --config "${config}" --stopwait`)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logT('sphinx', `ignoring sphinx closing because external sphinx instance`)
|
||||
@ -433,7 +440,7 @@ module.exports = async (callback, dataDirectory, onClose, params = {}) => {
|
||||
|
||||
const checkNullFile = (file) => new Promise((resolve) => {
|
||||
let f = fs.createReadStream(file)
|
||||
f.on('data', (chunk) => {
|
||||
f.on('data', (chunk) => {
|
||||
for(const byte of chunk)
|
||||
if(byte != 0)
|
||||
{
|
||||
@ -450,7 +457,7 @@ module.exports = async (callback, dataDirectory, onClose, params = {}) => {
|
||||
const probablyCoruptedFiles = await findFiles(`${sphinx.directoryPath}/**/*.+(meta|ram)`)
|
||||
let brokenFiles = await Promise.all(probablyCoruptedFiles.map(file => checkNullFile(file)))
|
||||
brokenFiles = probablyCoruptedFiles.filter((file, index) => !brokenFiles[index])
|
||||
|
||||
|
||||
brokenFiles.forEach(file => {
|
||||
logT('sphinx', 'FIXDB: clean file because of broken', file)
|
||||
fs.unlinkSync(file)
|
||||
@ -467,4 +474,4 @@ module.exports = async (callback, dataDirectory, onClose, params = {}) => {
|
||||
}
|
||||
|
||||
return await start(callback)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user