bcgov/greenlight

How to make other fields searchable in agent config?

kenhuang opened this issue · 5 comments

https://github.com/bcgov/greenlight/blob/master/config/Readme.md

From the document above, seems only source_id and name field in services.yml can be searchable, what is the best way to make other fields searchable?

esune commented

I haven't tried this before, but I think you should be able to add fields that can be searched by adding a mapping that refers to the name model. This should add an entry in the list of fields that Solr, the engine used for searching, will be able to look up when performing a lookup.

You would do something like this:

mapping:
        - model: name
          fields:
            text:
              input: legal_name
              from: claim
            type:
              input: org_name
              from: value

        - model: name
          fields:
            text:
              input: my_field
              from: claim
            type:
              input: some_other_field
              from: value

to allow searching on both the org_name and some_other_field.

Thanks for the suggestion, had tried the following config, only legal_name value been index in solr.

          - model: name
            fields:
              type:
                input: address_line_1
                from: claim
              value:
                input: address_line_1
                from: value
          - model: name
            fields:
              type:
                input: address_line_2
                from: claim
              value:
                input: address_line_2
                from: value
          - model: name
            fields:
              type:
                input: address_line_3
                from: claim
              value:
                input: address_line_3
                from: value
          - model: name
            fields:
              text:
                input: legal_name
                from: claim
              type:
                input: legal_name
                from: value

postgresql name table only store legal_name's value for some reason.
Screen Shot 2019-08-02 at 4 15 16 PM
Screen Shot 2019-08-02 at 4 22 47 PM

greenlight agent logs:

greenlight-agent_1       | 2019-08-02 03:11:12,033 DEBUG [vonx.common.exchange]: exec-1 processing message: StoredCredential(cred=Credential(cred_data={'schema_id': '2zypovHyY48M6HrnPm583w:2:GreenLight Company:1.0.23', 'cred_def_id': '2zypovHyY48M6HrnPm583w:3:CL:11:tag', 'rev_reg_id': None, 'values': {'postal_code': {'raw': '', 'encoded': '102987336249554097029535212322581322789799900648198034993379397001115665086549'}, 'legal_name': {'raw': 'HOMESTEAD GOLDEN CHICKEN PTY LIMITED', 'encoded': '47414988018128530341029506531478892942179629477174423802955648097905751777733'}, 'addressee': {'raw': '', 'encoded': '102987336249554097029535212322581322789799900648198034993379397001115665086549'}, 'country': {'raw': '', 'encoded': '102987336249554097029535212322581322789799900648198034993379397001115665086549'}, 'directors': {'raw': 'John Daniel MULLAN, Anthony John MULLAN', 'encoded': '77128252811394189023057183104443168055495806610178583494291997867153335258503'}, 'entity_name_effective': {'raw': '1989-07-14T00:00:00.000+12:00', 'encoded': '23545569759362727911334672297855356554634529386113844856467122710246629260363'}, 'entity_status': {'raw': 'Removed', 'encoded': '29444473980600932290611463480072874587016175514268788048148899903403268757162'}, 'effective_date': {'raw': '1973-01-26', 'encoded': '57295246009244377088618339244794312726390710615092169058917324436735397752371'}, 'entity_status_effective': {'raw': '1992-07-27T00:00:00.000+12:00', 'encoded': '86172952393139587192114204005924615095885469771307975939106893376846818842729'}, 'greenlight_party_id': {'raw': '9429037274139', 'encoded': '20935751043437734212959929452119696174874915921654808280745726482277824071791'}, 'address_line_3': {'raw': '163 THE TERRACE P O BOX 136, WELLINGTON', 'encoded': '97371040128938043279296837659342516855822932033272826036736771527832202487974'}, 'corp_num': {'raw': '6', 'encoded': '6'}, 'address_line_2': {'raw': 'FLR 9 CHASE NBA HOUSE', 'encoded': '28694033990424564551932519987617043621871138475232614115862206925379701396416'}, 'registration_id': {'raw': '6', 'encoded': '6'}, 'registration_date': {'raw': '1973-01-26', 'encoded': '57295246009244377088618339244794312726390710615092169058917324436735397752371'}, 'address_line_1': {'raw': 'BRUCE BORNHOLDT', 'encoded': '17074769680550119122590059259502617994655881823450234750480996169943168551715'}, 'greenlight_entity_type_description': {'raw': 'Overseas Non-ASIC Company', 'encoded': '12396405282166759525650990094492809731247483148678553645314725726806089896022'}, 'entity_name': {'raw': 'HOMESTEAD GOLDEN CHICKEN PTY LIMITED', 'encoded': '47414988018128530341029506531478892942179629477174423802955648097905751777733'}}, 'signature': {'p_credential': {'m_2': '3736280078794620163158039335325871475596134372004531585249831281682661569522', 'a': '69505392327687786092849829157762644668375835978481174499919807588485120734902894757003129102968799598496552581829842769961034966680978308068034287906319375432275059487899104836998082073081886525909339475542554321623866556257147021502677970948047214765218756618722186822226652613181813381154723439460534846995059816619369669981827039027042159515614871076337699576829876988451109673320559084582193453774971738921317228591072383117173346371669533474819910491029986956618356706280636401136188048712181926356324763181507287257964533479890995453216795345446193498542619293597724434222223560835514158161002813594483719523959', 'e': '259344723055062059907025491480697571938277889515152306249728583105665800713306759149981690559193987143012367913206299323899696942213235956742930085978915758615175706699783850205061', 'v': '6583255419838608781106619094026950835378191404502900442584061274466700673083378283282304446455184483578241404468977936455453521840811062179663737444509402595678888228787392916373731361999909493305286480467937005619165698781450690141971675792651569101128537731884838907567192285017420473964769325350192278153895089385617562364042655039122727088765804845014797317194898184195676409102485389177100127416625786864088276839880811362507045439562923081949966054497898611253562838228019131995139307418669971509885904376910950240662244384490338541104653298548936360594568646369941463431304984276464377743507695659034420650350036635821816131039340581366802011201249963779724898601725722265470794004054569104386960998080398798022182386865663867039010571292409320893045535656724173363242997390946593462937784762484995067567066662168'}, 'r_credential': None}, 'signature_correctness_proof': {'se': '1074613480740209995065111646089115901225614637148643927007170560727264709122248927582725551623899115438246022263194215793184838420151131273957185225564134428985172612614879812759421605019728379362237420813300991895681024353366091381945251788008334926275026438574888060767841238654068010230937145256368166100060917177678952081705542568274702517218739861343455121162032781816533221887188311309811813187824034685432841782896516745902069109705352571237272235626079521609383966826395212036584796988418489173802459710824881151967046222725280281898528496728115172909446481944460726645100659786668162646773297821943233065048', 'c': '14306662234897755823281867941551262238798798332171560063254146382559228099666'}, 'rev_reg': None, 'witness': None}, cred_req_metadata={'master_secret_blinding_data': {'v_prime': '2005959927934736523246726145768706175117069842402615252990943922746121537591848499335198210825642454657994936735180736181135965736877126043741726506644322471625583595777869822724466810865657420308268246129330002219114022383916947031128386174952361442897051460491107904690785044248436538387051517461315756466810464298921414701004632162908547012448939269637824714000832735550969365227448498245473089900935904243659295165958086799934401389196749992420390787560164741954274914251694248358710596053647800080155689970911277470124965565781447317545761024311471389902953158878651358142224355780078899751859155355394450583799893170278517930913385377', 'vr_prime': None}, 'nonce': '457717363110656097161482', 'master_secret_name': 'master-secret'}, cred_revoc_id=None), cred_id=4df96187-1ada-458d-90db-8713006518a1, served_by=181218d594ba)
esune commented

Tagging @andrewwhitehead in case he has more ideas.

Found where the problem is, change to the following should work.

          - model: name
            fields:
              text:
                input: address_line_1
                from: claim
              type:
                input: address_line_1
                from: value
          - model: name
            fields:
              text:
                input: address_line_2
                from: claim
              type:
                input: address_line_2
                from: value
          - model: name
            fields:
              text:
                input: address_line_3
                from: claim
              type:
                input: address_line_3
                from: value
          - model: name
            fields:
              text:
                input: legal_name
                from: claim
              type:
                input: legal_name
                from: value
esune commented

Awesome, thank you for circling back @kenhuang !