SFR-479 Add Claimants to ElasticSearch index
This adds a full `Claimant` object to the ElasticSearch index, including the `claimant_type` field which helps users see the specific relationship a claimant has to a renewal. It would be good to provide translations of these codes in the future, but this is not currently necessary.add-new-regnum-params
parent
edd14d9cdb
commit
812d0b7dce
|
@ -20,7 +20,8 @@ from model.registration import Registration as dbRegistration
|
||||||
from model.elastic import (
|
from model.elastic import (
|
||||||
CCE,
|
CCE,
|
||||||
Registration,
|
Registration,
|
||||||
Renewal
|
Renewal,
|
||||||
|
Claimant
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,9 +144,11 @@ class ESRen():
|
||||||
self.renewal = Renewal(meta={'id': self.dbRen.renewal_num})
|
self.renewal = Renewal(meta={'id': self.dbRen.renewal_num})
|
||||||
|
|
||||||
def indexRen(self):
|
def indexRen(self):
|
||||||
|
self.renewal.uuid = self.dbRen.uuid
|
||||||
self.renewal.rennum = self.dbRen.renewal_num
|
self.renewal.rennum = self.dbRen.renewal_num
|
||||||
self.renewal.rendate = self.dbRen.renewal_date
|
self.renewal.rendate = self.dbRen.renewal_date
|
||||||
self.renewal.title = self.dbRen.title
|
self.renewal.title = self.dbRen.title
|
||||||
self.renewal.claimants = [
|
self.renewal.claimants = [
|
||||||
c.name for c in self.dbRen.claimants
|
Claimant(name=c.name, claim_type=c.claimant_type)
|
||||||
|
for c in self.dbRen.claimants
|
||||||
]
|
]
|
||||||
|
|
|
@ -31,11 +31,18 @@ class Registration(BaseInner):
|
||||||
regdate = Date()
|
regdate = Date()
|
||||||
|
|
||||||
|
|
||||||
|
class Claimant(BaseInner):
|
||||||
|
name = Text(fields={'keyword': Keyword()})
|
||||||
|
claim_type = Keyword()
|
||||||
|
|
||||||
|
|
||||||
class Renewal(BaseDoc):
|
class Renewal(BaseDoc):
|
||||||
|
uuid = Keyword(store=True)
|
||||||
rennum = Keyword()
|
rennum = Keyword()
|
||||||
rendate = Date()
|
rendate = Date()
|
||||||
title = Text(fields={'keyword': Keyword()})
|
title = Text(fields={'keyword': Keyword()})
|
||||||
claimants = Text(multi=True)
|
|
||||||
|
claimants = Nested(Claimant)
|
||||||
|
|
||||||
class Index:
|
class Index:
|
||||||
with open('config.yaml', 'r') as yamlFile:
|
with open('config.yaml', 'r') as yamlFile:
|
||||||
|
|
Loading…
Reference in New Issue