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'
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}
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)))
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