Coverage for sample_project/querysets.py: 0%

6 statements  

« prev     ^ index     » next       coverage.py v7.6.8, created at 2024-12-20 09:24 +0000

1import os 

2 

3from apis_core.utils.autocomplete import ( 

4 ExternalAutocomplete, 

5 LobidAutocompleteAdapter, 

6 TypeSenseAutocompleteAdapter, 

7) 

8 

9 

10class PlaceExternalAutocomplete(ExternalAutocomplete): 

11 adapters = [ 

12 TypeSenseAutocompleteAdapter( 

13 collections=[ 

14 "prosnet-wikidata-place-index", 

15 "prosnet-geonames-place-index", 

16 ], 

17 token=os.getenv("TYPESENSE_TOKEN", None), 

18 server=os.getenv("TYPESENSE_SERVER", None), 

19 ), 

20 LobidAutocompleteAdapter( 

21 params={ 

22 "filter": "type:PlaceOrGeographicName", 

23 "format": "json:preferredName", 

24 } 

25 ), 

26 ] 

27 

28 

29class PersonExternalAutocomplete(ExternalAutocomplete): 

30 adapters = [ 

31 TypeSenseAutocompleteAdapter( 

32 collections="prosnet-wikidata-person-index", 

33 token=os.getenv("TYPESENSE_TOKEN", None), 

34 server=os.getenv("TYPESENSE_SERVER", None), 

35 ), 

36 LobidAutocompleteAdapter( 

37 params={ 

38 "filter": "type:Person", 

39 "format": "json:preferredName,professionOrOccupation", 

40 } 

41 ), 

42 ]