Check for Claim field
This commit is contained in:
parent
3a061df1a4
commit
4f5206d18e
1 changed files with 15 additions and 12 deletions
|
@ -52,19 +52,22 @@ export async function claimSync () {
|
||||||
let claims = JSON.parse(claimsResponse).data;
|
let claims = JSON.parse(claimsResponse).data;
|
||||||
status.info = 'addingClaimsToElastic';
|
status.info = 'addingClaimsToElastic';
|
||||||
for (let claim of claims) {
|
for (let claim of claims) {
|
||||||
claim.value = JSON.parse(claim.value).Claim;
|
const parsedClaim = JSON.parse(claim.value);
|
||||||
if (claim.name && claim.value) {
|
if (parsedClaim.Claim) {
|
||||||
claim.suggest_name = {
|
claim.value = JSON.parse(claim.value).Claim;
|
||||||
input : '' + claim.name + '',
|
if (claim.name && claim.value) {
|
||||||
weight: '30',
|
claim.suggest_name = {
|
||||||
};
|
input : '' + claim.name + '',
|
||||||
|
weight: '30',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (claim.bid_state === 'Spent' || claim.bid_state === 'Expired') {
|
||||||
|
deleteFromElastic(claim.claimId);
|
||||||
|
} else {
|
||||||
|
pushElastic(claim);
|
||||||
|
}
|
||||||
|
lastID = claim.id;
|
||||||
}
|
}
|
||||||
if (claim.bid_state === 'Spent' || claim.bid_state === 'Expired') {
|
|
||||||
deleteFromElastic(claim.claimId);
|
|
||||||
} else {
|
|
||||||
pushElastic(claim);
|
|
||||||
}
|
|
||||||
lastID = claim.id;
|
|
||||||
}
|
}
|
||||||
winston.log('info', '[Importer] Pushed ' + claims.length + ' claims to elastic search [LastID]' + lastID);
|
winston.log('info', '[Importer] Pushed ' + claims.length + ' claims to elastic search [LastID]' + lastID);
|
||||||
finished = claims.length < groupSize;
|
finished = claims.length < groupSize;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue