Commit f98c544d authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Removed obsolete type attribute.

parent 1767e4da
Pipeline #75006 canceled with stages
in 20 seconds
......@@ -101,7 +101,6 @@ class EncMaterialResource(Resource):
def get(self, material_id):
"""Used to retrive basic information related to the specified material.
"""
# Find the first public entry with this material id and take
# information from there. In principle all other entries should have
# the same information.
......@@ -417,3 +416,80 @@ class EncMaterialsResource(Resource):
"pages": pages,
}
return result, 200
group_result = api.model('group_result', {
"calculation_list": fields.List(fields.String),
"energy_minimum": fields.Float,
"group_hash": fields.String,
"group_type": fields.String,
"method_hash": fields.String,
"nr_of_calculations": fields.Integer,
"representative_calculation_id": fields.String,
})
groups_result = api.model('groups_result', {
'total_groups': fields.Integer(allow_null=False),
'groups': fields.List(fields.Nested(group_result)),
})
# @ns.route('/materials/<string:material_id>/groups')
# class EncGroupsResource(Resource):
# @api.response(404, 'Material not found')
# @api.response(400, 'Bad request')
# @api.response(200, 'Metadata send', fields.Raw)
# @api.expect(material_query, validate=False)
# @api.marshal_with(groups_result, skip_none=True)
# @api.doc('materials')
# def get(self, material_id):
# def pipeline(hash_key, group_type, minsize):
# return [
# {"$match": {
# "encyclopedia.material.material_id": material_id,
# "published": True,
# "with_embargo": False,
# }},
# {"$lookup": {
# "from": "energies",
# "localField": "_id",
# "foreignField": "calc_id",
# "as": "energy"
# }},
# {"$unwind": "$energy"},
# {"$match": {"energy.e_kind": "Total E"}},
# {"$sort": {"energy.e_val": 1}},
# {"$group": {
# "_id": {
# "group_hash": "$%s" % hash_key
# },
# "calculations_list": {"$push": "$_id"},
# "minimum": {"$first": {"energy": "$energy.e_val", "calc_id": "$_id"}}
# }},
# {"$addFields": {"nr_of_calculations": {"$size": "$calculations_list"}}},
# {"$match": {"nr_of_calculations": {"$gt": minsize}}},
# {"$project": {
# "_id": False,
# "nr_of_calculations": True,
# "calculations_list": True,
# "energy_minimum": "$minimum.energy",
# "representative_calculation_id": "$minimum.calc_id",
# "group_hash": "$_id.group_hash",
# "group_type": group_type,
# "material_hash": material_id
# }}
# ]
# # Find EOS groups
# s = Search(index=config.elastic.index_name)
# s.aggs.pipeline("pipeline", pipeline("group_eos_hash", "equation of state", 4))
# eos_groups = s.execute()
# s = Search(index=config.elastic.index_name)
# s.aggs.pipeline("pipeline", pipeline("group_parametervariation_hash", "parameter variation", 2))
# convergence_groups = s.execute()
# groups = eos_groups + convergence_groups
# for group in groups:
# group["calculations_list"] = [int(calc) for calc in group["calculations_list"]]
# group["representative_calculation_id"] = int(group["representative_calculation_id"])
# return dict(groups=groups, total_groups=len(groups)), 200
......@@ -171,9 +171,6 @@ class ElasticDocument(SectionAnnotation):
# Use keyword type for shallow references
if isinstance(quantity.type, Reference) and annotation.shallow:
annotation.mapping = Keyword(**kwargs)
# If an explicit type is given, use it
elif annotation.type is not None:
annotation.mapping = annotation.type(**kwargs)
# Otherwise find a mapping based on quantity type
else:
if quantity.type == str:
......
......@@ -74,8 +74,6 @@ class Search(Elastic):
This might be different from the field that is used to store the value in
elastic search. This is especially useful if the field represents a inner
document and a subfield of this inner object should be used for search.
type: Determines the data type class used in the ElasticSearch mapping.
Defaults to determining the type from the quantity type.
shallow: Determines how a reference is handled in the search index. If
set to True, only the unresolved reference proxy path (m_proxy_path) is
stored. If False, the whole referenced section will be stored.
......@@ -92,7 +90,6 @@ class Search(Elastic):
statistic_values: List[str] = None,
derived: Callable[[Any], Any] = None,
search_field: str = None,
type: str = None,
shallow: bool = False,
**kwargs):
......@@ -112,7 +109,6 @@ class Search(Elastic):
self.statistic_order = statistic_order
self.statistic_values = statistic_values
self.search_field = search_field
self.type = type
self.shallow = shallow
self.derived = derived
......
Supports Markdown
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