feat: fullname search (#8641)
* feat: fullname search * fix: take last element * fix: attempt to fix psql like query * feat: upgrade sript, another fix attempt * fix: psql test * fix: psql scan * feat: add debug for test * feat: test collate * feat: cleanup * fix: upgrade scriptv1.18.x
parent
9389749b79
commit
4be693f2e7
@ -0,0 +1,26 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const db = require('../../database');
|
||||||
|
|
||||||
|
const batch = require('../../batch');
|
||||||
|
const user = require('../../user');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'Create fullname search set',
|
||||||
|
timestamp: Date.UTC(2020, 8, 11),
|
||||||
|
method: async function () {
|
||||||
|
const progress = this.progress;
|
||||||
|
|
||||||
|
await batch.processSortedSet('users:joindate', async function (uids) {
|
||||||
|
progress.incr(uids.length);
|
||||||
|
const userData = await user.getUsersFields(uids, ['uid', 'fullname']);
|
||||||
|
const bulkAdd = userData
|
||||||
|
.filter(u => u.uid && u.fullname)
|
||||||
|
.map(u => ['fullname:sorted', 0, u.fullname.toLowerCase() + ':' + u.uid]);
|
||||||
|
await db.sortedSetAddBulk(bulkAdd);
|
||||||
|
}, {
|
||||||
|
batch: 500,
|
||||||
|
progress: this.progress,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in New Issue