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