Commit deb46fec authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added more fields to search index.

parent 1e584c3b
......@@ -135,15 +135,37 @@ def analyze_searchdata():
def render_es_result(result):
fields = [
'formula', 'formula_reduced', 'material_id', 'material_name', 'calculations',
'space_group_number', 'structure_type', 'system_type'
'formula_cell',
'formula_reduced',
'atom_labels_keyword'
'material_id',
'material_name',
'calculations',
'space_group_number',
'space_group_international_short_symbol',
'strukturbericht_designation',
'structure_type',
'structure_prototype',
'system_type',
'crystal_system',
'basis_set_type',
'functional_type'
]
renames = {
'material_id': 'id',
'atom_labels_keyword': 'atom_labels',
'calculations': 'nr_of_calculations'
}
legacy_values = {
'formula': result.get('formula_cell')
}
es_result = {renames.get(field, field): result.get(field) for field in fields}
es_result.update(**legacy_values)
return {renames.get(field, field): result.get(field) for field in fields}
return es_result
@api.route('/materials', methods=['POST'])
......@@ -175,7 +197,7 @@ def get_materials(page, per_page):
if exclusive:
match_query['atom_labels_keyword'] = dict(query="".join(sort_elements(elements)))
else:
match_query['atom_labels'] = dict(query=" ".join(elements), operator='and')
match_query['atom_labels_terms'] = dict(query=" ".join(elements), operator='and')
# create filters
filter_queries = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment