mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #34884 from overleaf/em-already-in-your-library
Library import: flag entries that are already in the user's library GitOrigin-RevId: f3c92fb59283631e1a9e78d2e08a3a365981df45
This commit is contained in:
@@ -4,6 +4,7 @@ import logger from '@overleaf/logger'
|
||||
import { db } from '../app/src/infrastructure/mongodb.mjs'
|
||||
import {
|
||||
buildSearchTokens,
|
||||
buildMatchTokens,
|
||||
docSchema,
|
||||
} from '../modules/library/app/src/LibraryReferenceRepository.mts'
|
||||
import { tokenize } from '../modules/library/app/src/bibtex-search-tokens.mts'
|
||||
@@ -21,10 +22,10 @@ function usage() {
|
||||
{},
|
||||
`Usage: node backfill_library_references_search.mjs [options]
|
||||
|
||||
Populates searchKey and searchTokens on libraryReferences so the
|
||||
account-level library search can index them. Also unsets the obsolete
|
||||
fields.$[].searchValue. Safe to rerun; picks up only un-indexed rows
|
||||
by default.
|
||||
Populates searchKey, searchTokens and matchTokens on libraryReferences so
|
||||
the account-level library search and import duplicate-detection can index
|
||||
them. Also unsets the obsolete fields.$[].searchValue. Safe to rerun; picks
|
||||
up only un-indexed rows by default.
|
||||
|
||||
Options:
|
||||
--commit Apply changes. Without this, runs as a dry run.
|
||||
@@ -73,11 +74,12 @@ async function backfill(trackProgress) {
|
||||
})
|
||||
const searchKey = tokenize(doc.key)
|
||||
const searchTokens = buildSearchTokens(entry)
|
||||
const matchTokens = buildMatchTokens(entry)
|
||||
ops.push({
|
||||
updateOne: {
|
||||
filter: { _id: doc._id },
|
||||
update: {
|
||||
$set: { searchKey, searchTokens },
|
||||
$set: { searchKey, searchTokens, matchTokens },
|
||||
$unset: { 'fields.$[].searchValue': 1 },
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user