Closed dr-rodriguez closed 4 years ago
The query method now has an option, embed_ref, which tells the code to embed the reference into the document results. Example without embedding:
doc = db.query({'name': 'And XXX'})[0]['ebv'][0]
print(json.dumps(doc, indent=4, sort_keys=False))
{
"value": 0.166,
"best": 1,
"reference": "Bellazzini_2006_1"
}
With embedding:
doc = db.query({'name': 'And XXX'}, embed_ref=True)[0]['ebv'][0]
print(json.dumps(doc, indent=4, sort_keys=False))
{
"value": 0.166,
"best": 1,
"reference": {
"key": "Bellazzini_2006_1",
"id": 1,
"year": 2006,
"doi": "10.1111/j.1365-2966.2005.09973.x",
"bibcode": "2006MNRAS.366..865B",
"authors": [
"Bellazzini, M.",
"Ibata, R.",
"Martin, N.",
"Lewis, G. F.",
"Conn, B.",
"Irwin, M. J."
],
"journal": "MNRAS",
"title": "The core of the Canis Major galaxy as traced by red clump stars"
}
}
There is now a query_reference method that directly queries the references alone, if you want searches just against that: db.query_reference({'key': 'Bellazzini_2006_1'})
Create references.json that stores all references use. Database entries should refer to this file/collection.