def get_properties_against_project_id(es, project_id): search_query = {"query": {"match": {"project_id": project_id}}} size = get_count_of_property_records(es) response_data, total_records = es.search_document( ["property"], search_query, 1, size, [], ["thumbnails", "full_size_images", "property_photo", "property_id"]) return response_data
def get_builder_properties(request_data): if request_data: request_data = json.loads(request_data) email = putil.validate_for_user_id_exists(request_data.get("user_id")) search_query = { "query": { "match": { "project_by": request_data.get("builder") } } } try: es = ElasticSearchController() size = get_count_of_property_records(es) response_data, total_records = es.search_document( ["property"], search_query, request_data.get("page_number", 1), size) # response data & pagination logic msg = "User Property Found" if len( response_data) else "User Property not found" return putil.init_pagination_and_response_generatrion( request_data, response_data, msg, total_records) except elasticsearch.ElasticsearchException, e: raise ElasticSearchException(e.error) except Exception, e: raise OperationFailed("Get Agent Properties Operation Failed")
def get_all_properties(request_data): if request_data: request_data = json.loads(request_data) email = putil.validate_for_user_id_exists(request_data.get("user_id")) search_query = { } try: include_list = ["property_id", "property_title", "property_photo"] es = ElasticSearchController() size = get_count_of_property_records(es) response_data, total_records = es.search_document(["property"], search_query, request_data.get("page_number",1), size, [], include_list) # response data & pagination logic msg = "User Property Found" if len(response_data) else "User Property not found" return putil.init_pagination_and_response_generatrion(request_data, response_data, msg, total_records) except elasticsearch.ElasticsearchException,e: raise ElasticSearchException(e.error) except Exception,e: raise OperationFailed("Get All Properties Operation Failed")
def get_builder_properties(request_data): if request_data: request_data = json.loads(request_data) email = putil.validate_for_user_id_exists(request_data.get("user_id")) search_query = { "query": { "match":{ "project_by":request_data.get("builder") } } } try: es = ElasticSearchController() size = get_count_of_property_records(es) response_data, total_records = es.search_document(["property"], search_query, request_data.get("page_number",1), size) # response data & pagination logic msg = "User Property Found" if len(response_data) else "User Property not found" return putil.init_pagination_and_response_generatrion(request_data, response_data, msg, total_records) except elasticsearch.ElasticsearchException,e: raise ElasticSearchException(e.error) except Exception,e: raise OperationFailed("Get Agent Properties Operation Failed")
def get_all_properties(request_data): if request_data: request_data = json.loads(request_data) email = putil.validate_for_user_id_exists(request_data.get("user_id")) search_query = { } try: include_list = ["property_id", "property_title", "property_photo"] es = ElasticSearchController() size = get_count_of_property_records(es) response_data, total_records = es.search_document(["property"], search_query, request_data.get("page_number",1), size, [], include_list) # response data & pagination logic msg = "User Property Found" if len(response_data) else "User Property not found" return putil.init_pagination_and_response_generatrion(request_data, response_data, msg, total_records) except elasticsearch.ElasticsearchException,e: raise ElasticSearchException(e.error) except Exception,e: raise OperationFailed("Get All Properties Operation Failed")
def get_properties_against_project_id(es, project_id): search_query = { "query": { "match": { "project_id": project_id } } } size = get_count_of_property_records(es) response_data, total_records = es.search_document(["property"], search_query, 1, size, [], ["thumbnails", "full_size_images", "property_photo", "property_id"]) return response_data