change index method

This commit is contained in:
mxr612 2024-08-22 12:53:20 +08:00
parent d777202863
commit e70f5fea1c
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ def query(query:str):
if not mysql_connector.is_loaded(i['paperId']): if not mysql_connector.is_loaded(i['paperId']):
res.append({ res.append({
'id':i['paperId'], 'id':i['paperId'],
'q':str(i['title']), 'q':str(i['citationStyles']['bibtex']),
'a':str(i['abstract']), 'a':str(i['abstract']),
'score':[] 'score':[]
}) })

View File

@ -20,5 +20,5 @@ def search_paper(question):
for i in question: for i in question:
query += "+" + i query += "+" + i
res = requests.get(headers={'x-api-key':__CONFIG__['semAPI']}, res = requests.get(headers={'x-api-key':__CONFIG__['semAPI']},
url= 'https://api.semanticscholar.org/graph/v1/paper/search?fieldsOfStudy=Psychology&fields=title,abstract&query='+query[+1:]).json() url= 'https://api.semanticscholar.org/graph/v1/paper/search?fieldsOfStudy=Psychology&fields=abstract,citationStyles&query='+query[+1:]).json()
return res['data'] return res['data']