search.controllers.advanced.forms module

Provides form rendering and validation for the advanced search feature.

class search.controllers.advanced.forms.AdvancedSearchForm(formdata=None, obj=None, prefix='', data=None, meta=None, **kwargs)[source]

Bases: wtforms.form.Form

Replacement for the ‘classic’ advanced search interface.

HIDE_ABSTRACTS = 'hide'
SHOW_ABSTRACTS = 'show'
abstracts = <UnboundField(RadioField, ('Abstracts',), {'choices': [('show', 'Show abstracts'), ('hide', 'Hide abstracts')], 'default': 'show'})>
advanced = <UnboundField(HiddenField, ('Advanced',), {'default': 1})>

Used to indicate whether the form should be shown.

classification = <UnboundField(FormField, (<class 'search.controllers.advanced.forms.ClassificationForm'>,), {})>
date = <UnboundField(FormField, (<class 'search.controllers.advanced.forms.DateForm'>,), {})>
include_older_versions = <UnboundField(BooleanField, ('Include older versions of papers',), {})>
order = <UnboundField(SelectField, ('Sort results by',), {'choices': [('-announced_date_first', 'Announcement date (newest first)'), ('announced_date_first', 'Announcement date (oldest first)'), ('-submitted_date', 'Submission date (newest first)'), ('submitted_date', 'Submission date (oldest first)'), ('', 'Relevance')], 'validators': [<wtforms.validators.Optional object>], 'default': '-announced_date_first'})>
size = <UnboundField(SelectField, ('results per page',), {'default': 50, 'choices': [('25', '25'), ('50', '50'), ('100', '100'), ('200', '200')]})>
terms = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'search.controllers.advanced.forms.FieldForm'>,), {})>,), {'min_entries': 1})>
class search.controllers.advanced.forms.ClassificationForm(formdata=None, obj=None, prefix='', data=None, meta=None, **kwargs)[source]

Bases: wtforms.form.Form

Subform for selecting a classification to (disjunctively) filter by.

ARCHIVES = [('cs', 'computer_science'), ('econ', 'economics'), ('eess', 'eess'), ('math', 'mathematics'), ('physics', 'physics'), ('q-bio', 'q_biology'), ('q-fin', 'q_finance'), ('stat', 'statistics')]
EXCLUDE_CROSS_LIST = 'exclude'
INCLUDE_CROSS_LIST = 'include'
PHYSICS_ARCHIVES = [('all', 'all'), ('astro-ph', 'astro-ph'), ('cond-mat', 'cond-mat'), ('gr-qc', 'gr-qc'), ('hep-ex', 'hep-ex'), ('hep-lat', 'hep-lat'), ('hep-ph', 'hep-ph'), ('hep-th', 'hep-th'), ('math-ph', 'math-ph'), ('nlin', 'nlin'), ('nucl-ex', 'nucl-ex'), ('nucl-th', 'nucl-th'), ('physics', 'physics'), ('quant-ph', 'quant-ph')]
computer_science = <UnboundField(BooleanField, ('Computer Science (cs)',), {})>
economics = <UnboundField(BooleanField, ('Economics (econ)',), {})>
eess = <UnboundField(BooleanField, ('Electrical Engineering and Systems Science (eess)',), {})>
include_cross_list = <UnboundField(RadioField, ('Include cross-list',), {'choices': [('include', 'Include cross-listed papers'), ('exclude', 'Exclude cross-listed papers')], 'default': 'include'})>
mathematics = <UnboundField(BooleanField, ('Mathematics (math)',), {})>
physics = <UnboundField(BooleanField, ('Physics',), {})>
physics_archives = <UnboundField(SelectField, (), {'choices': [('all', 'all'), ('astro-ph', 'astro-ph'), ('cond-mat', 'cond-mat'), ('gr-qc', 'gr-qc'), ('hep-ex', 'hep-ex'), ('hep-lat', 'hep-lat'), ('hep-ph', 'hep-ph'), ('hep-th', 'hep-th'), ('math-ph', 'math-ph'), ('nlin', 'nlin'), ('nucl-ex', 'nucl-ex'), ('nucl-th', 'nucl-th'), ('physics', 'physics'), ('quant-ph', 'quant-ph')], 'default': 'all'})>
q_biology = <UnboundField(BooleanField, ('Quantitative Biology (q-bio)',), {})>
q_finance = <UnboundField(BooleanField, ('Quantitative Finance (q-fin)',), {})>
statistics = <UnboundField(BooleanField, ('Statistics (stat)',), {})>
class search.controllers.advanced.forms.DateForm(formdata=None, obj=None, prefix='', data=None, meta=None, **kwargs)[source]

Bases: wtforms.form.Form

Subform with options for limiting results by publication date.

ANNOUNCED = 'announced_date_first'
DATE_TYPE_CHOICES = [('submitted_date', 'Submission date (most recent)'), ('submitted_date_first', 'Submission date (original)'), ('announced_date_first', 'Announcement date')]
SUBMITTED_CURRENT = 'submitted_date'
SUBMITTED_ORIGINAL = 'submitted_date_first'
date_type = <UnboundField(RadioField, ('Apply to',), {'choices': [('submitted_date', 'Submission date (most recent)'), ('submitted_date_first', 'Submission date (original)'), ('announced_date_first', 'Announcement date')], 'default': 'submitted_date', 'description': 'You may filter on either submission date or announcement date. Note that announcement date supports only year and month granularity.'})>
filter_by = <UnboundField(RadioField, ('Filter by',), {'choices': [('all_dates', 'All dates'), ('past_12', 'Past 12 months'), ('specific_year', 'Specific year'), ('date_range', 'Date range')], 'default': 'all_dates'})>
from_date = <UnboundField(MultiFormatDateField, ('From',), {'validators': [<wtforms.validators.Optional object>, <function yearInBounds>], 'formats': ['%Y-%m-%d', '%Y-%m', '%Y']})>
to_date = <UnboundField(MultiFormatDateField, ('to',), {'validators': [<wtforms.validators.Optional object>, <function yearInBounds>], 'formats': ['%Y-%m-%d', '%Y-%m', '%Y'], 'default_upper_bound': True})>
validate_filter_by(field)[source]

Ensure that related fields are filled.

Return type:None
year = <UnboundField(DateField, ('Year',), {'format': '%Y', 'validators': [<wtforms.validators.Optional object>, <function yearInBounds>]})>
class search.controllers.advanced.forms.FieldForm(formdata=None, obj=None, prefix='', data=None, meta=None, **kwargs)[source]

Bases: wtforms.form.Form

Subform for query parts on specific fields.

field = <UnboundField(SelectField, ('Field',), {'choices': [('title', 'Title'), ('author', 'Author(s)'), ('abstract', 'Abstract'), ('comments', 'Comments'), ('journal_ref', 'Journal reference'), ('acm_class', 'ACM classification'), ('msc_class', 'MSC classification'), ('report_num', 'Report number'), ('paper_id', 'arXiv identifier'), ('cross_list_category', 'Cross-list category'), ('doi', 'DOI'), ('orcid', 'ORCID'), ('author_id', 'arXiv author ID'), ('all', 'All fields')]})>
operator = <UnboundField(SelectField, ('Operator',), {'choices': [('AND', 'AND'), ('OR', 'OR'), ('NOT', 'NOT')], 'default': 'AND'})>
term = <UnboundField(StringField, ('Search term...',), {'filters': [<function strip_white_space>], 'validators': [<function does_not_start_with_wildcard>, <function has_balanced_quotes>]})>
class search.controllers.advanced.forms.MultiFormatDateField(label=None, validators=None, formats=['%Y-%m-%d %H:%M:%S'], default_upper_bound=False, **kwargs)[source]

Bases: wtforms.fields.core.DateField

Extends DateField to support multiple date formats.

process_formdata(valuelist)[source]

Try date formats until one sticks, or raise ValueError.

Return type:None
search.controllers.advanced.forms.yearInBounds(form, field)[source]

May not be prior to 1991, or later than the current year.

Return type:None