Skip to content

Commit

Permalink
update: limit the response fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJHANG committed Feb 2, 2024
1 parent 7484dc7 commit fa77b0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils/solr_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ def __init__(self, core, facet_values=[]):
self.solr_response = {}
self.solr_url = ''
self.solr_q = 'basisOfRecord:*' # Only fetch occurrence data, using basisOfRecord to estimate
# Limit the respoense fields
self.filter_field = 'taibif_vernacular_name,taibif_country,taibif_locality,basisOfRecord,taibif_datasetKey,formatted_name,taibif_dataset_name_zh,kingdomzh,phylumzh,classzh,orderzh,familyzh,genuszh,taibif_occ_id'

def generate_solr_url(self, req_lists=[]):
map_query = ''
Expand Down Expand Up @@ -267,7 +269,7 @@ def generate_solr_url(self, req_lists=[]):
self.solr_tuples.append(('json.facet', '{'f'{s}''}'))

query_string = urllib.parse.urlencode(self.solr_tuples)
self.solr_url = f'{SOLR_PREFIX}{self.core}/select?{query_string}'
self.solr_url = f'{SOLR_PREFIX}{self.core}/select?fl={self.filter_field}&{query_string}'
return self.solr_url

def request(self, req_lists=[]):
Expand Down

0 comments on commit fa77b0b

Please sign in to comment.