fix(db): fix search index on replication
This commit is contained in:
parent
1695d42317
commit
000947a6c2
@ -506,6 +506,8 @@ const insertTorrentToDB = (torrent) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
torrent.nameIndex = torrent.name
|
||||||
|
|
||||||
mysqlSingle.insertValues('torrents', torrent, function(err, result) {
|
mysqlSingle.insertValues('torrents', torrent, function(err, result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
send('newTorrent', {
|
send('newTorrent', {
|
||||||
@ -543,6 +545,7 @@ const insertTorrentToDB = (torrent) => {
|
|||||||
|
|
||||||
filesList.forEach((file) => {
|
filesList.forEach((file) => {
|
||||||
file.id = filesId++;
|
file.id = filesId++;
|
||||||
|
file.pathIndex = file.path;
|
||||||
mysqlSingle.insertValues('files', file, function(err, result) {
|
mysqlSingle.insertValues('files', file, function(err, result) {
|
||||||
if(!result) {
|
if(!result) {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
@ -576,7 +579,6 @@ const updateTorrent = (metadata, infohash, rinfo) => {
|
|||||||
const filesAdd = (path, size) => filesArray.push({
|
const filesAdd = (path, size) => filesArray.push({
|
||||||
hash,
|
hash,
|
||||||
path,
|
path,
|
||||||
pathIndex: path,
|
|
||||||
size,
|
size,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -601,7 +603,6 @@ const updateTorrent = (metadata, infohash, rinfo) => {
|
|||||||
const torrentQ = {
|
const torrentQ = {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
name: metadata.info.name,
|
name: metadata.info.name,
|
||||||
nameIndex: metadata.info.name,
|
|
||||||
size: size,
|
size: size,
|
||||||
files: filesCount,
|
files: filesCount,
|
||||||
piecelength: metadata.info['piece length'],
|
piecelength: metadata.info['piece length'],
|
||||||
|
Loading…
Reference in New Issue
Block a user