def _get_upcoming_conferences(): today = date.today() in_six_months = today + relativedelta(months=+6) upcoming_conferences = ConferencesSearch().query_from_iq( 'opening_date:{0}->{1}'.format(str(today), str(in_six_months)) ).sort( {'opening_date': 'asc'} )[1:100].execute() return [hit['_source'] for hit in upcoming_conferences.to_dict()['hits']['hits']]
def conferences(): """View for conferences collection landing page.""" number_of_records = ConferencesSearch().count() upcoming_conferences = _get_upcoming_conferences() return render_template( 'inspirehep_theme/search/collection_conferences.html', collection='conferences', conferences_subject_areas=CONFERENCE_CATEGORIES_TO_SERIES, number_of_records=number_of_records, result=upcoming_conferences, )
def conferences_in_the_same_series_from_es(seriesname): """Query ES for conferences in the same series.""" query = 'series:"{}"'.format(seriesname) return ConferencesSearch().query_from_iq( query ).params( _source=[ 'control_number', 'titles', 'addresses', 'opening_date', 'closing_date' ] ).sort("-opening_date").execute().hits