示例#1
0
def test_author_and_not_type_code():
    query = InspireQuery('a nilles,h and not tc I')

    expected = {}
    result = query.body

    assert expected == result
示例#2
0
def test_find_field_code():
    query = InspireQuery('find fc a')

    expected = {'query': {'multi_match': {'query': 'a', 'fields': ['field_code']}}}
    result = query.body

    assert expected == result
示例#3
0
def test_find_type_code():
    query = InspireQuery('find tc book')

    expected = {'query': {'multi_match': {'query': 'book', 'fields': ['collection']}}}
    result = query.body

    assert expected == result
示例#4
0
def test_find_caption():
    query = InspireQuery('Diagram for the fermion flow violating process')

    expected = {}
    result = query.body

    assert expected == result
示例#5
0
def test_find_country_code():
    query = InspireQuery('find cc italy')

    expected = {}
    result = query.body

    assert expected == result
示例#6
0
def test_find_journal():
    query = InspireQuery('find j "Phys.Rev.Lett.,105*"')

    expected = {
        'query': {
            'multi_match': {
                'query': '"Phys.Rev.Lett.,105*"',
                'fields': [
                    'publication_info.recid',
                    'publication_info.page_artid',
                    'publication_info.journal_issue',
                    'publication_info.conf_acronym',
                    'publication_info.journal_title',
                    'publication_info.reportnumber',
                    'publication_info.confpaper_info',
                    'publication_info.journal_volume',
                    'publication_info.cnum',
                    'publication_info.pubinfo_freetext',
                    'publication_info.year_raw',
                    'publication_info.isbn',
                    'publication_info.note'
                ]
            }
        }
    }
    result = query.body

    assert expected == result
示例#7
0
def test_find_author_and_date():
    query = InspireQuery('find a hatta and date after 2000')

    expected = {
        'query': {
            'bool': {
                'must': [
                    {
                        'bool': {
                            'must': [
                                {'match': {'authors.name_variations': 'hatta'}}
                            ],
                            'should': [
                                {'match': {'authors.full_name': 'hatta'}}
                            ]
                        }
                    },
                    {
                        'bool': {
                            'should': [
                                {'range': {'imprints.date': {'gt': '2000'}}},
                                {'range': {'preprint_date': {'gt': '2000'}}},
                                {'range': {'thesis.date': {'gt': '2000'}}},
                                {'range': {'publication_info.year': {'gt': '2000'}}}                            ]
                        }
                    }
                ]
            }
        }
    }
    result = query.body

    assert expected == result
示例#8
0
def test_citedby_colon_recid_colon():
    query = InspireQuery('citedby:recid:902780')

    expected = {}
    result = query.body

    assert expected == result
示例#9
0
def test_eprint_colon_without_arxiv():
    query = InspireQuery('eprint:TODO')

    expected = {}
    result = query.body

    assert expected == result
示例#10
0
def test_author_colon_or_eprint_without_keyword():
    query = InspireQuery('author:"Takayanagi, Tadashi" or hep-th/0010101')

    expected = {}
    result = query.body

    assert expected == result
示例#11
0
def test_citedby_colon():
    query = InspireQuery('citedby:foobar')

    expected = {}
    result = query.body

    assert expected == result
示例#12
0
def test_author_colon_bai_with_double_quotes_and_collection_colon():
    query = InspireQuery('author:"E.Witten.1" AND collection:citeable')

    expected = {}
    result = query.body

    assert expected == result
示例#13
0
def test_author_colon_bai():
    query = InspireQuery('author:Y.Nomura.1')

    expected = {}
    result = query.body

    assert expected == result
示例#14
0
def test_exactauthor():
    query = InspireQuery('ea wu, xing gang')

    expected = {}
    result = query.body

    assert expected == result
示例#15
0
def test_type_code_colon():
    query = InspireQuery('tc: l')

    expected = {'query': {'multi_match': {'query': 'l', 'fields': ['collection']}}}
    result = query.body

    assert expected == result
示例#16
0
def test_exactauthor_colon():
    query = InspireQuery('ea:matt visser')

    expected = {}
    result = query.body

    assert expected == result
示例#17
0
def test_google_style():
    query = InspireQuery('kudenko')

    expected = {
        'query': {
            'multi_match': {
                'zero_terms_query': 'all',
                'query': 'kudenko',
                'fields': [
                    'title^3',
                    'title.raw^10',
                    'abstract^2',
                    'abstract.raw^4',
                    'author^10',
                    'author.raw^15',
                    'reportnumber^10',
                    'eprint^10',
                    'doi^10'
                ]
            }
        }
    }
    result = query.body

    assert expected == result
示例#18
0
def test_exactauthor_colon_and_collection_colon():
    query = InspireQuery('ea: matt visser AND collection:citeable')

    expected = {}
    result = query.body

    assert expected == result
示例#19
0
def test_find_author_bai():
    query = InspireQuery('find a B.R.Safdi.1')

    expected = {}
    result = query.body

    assert expected == result
示例#20
0
def test_exactauthor_colon_bai():
    query = InspireQuery('exactauthor:J.Serra.3')

    expected = {}
    result = query.body

    assert expected == result
示例#21
0
def test_find_author_or_author():
    query = InspireQuery('find a gersdorff, g or a von gersdorff, g')

    expected = {
        'query': {
            'bool': {
                'should': [
                    {
                        'bool': {
                            'must': [
                                {'match': {'authors.name_variations': 'gersdorff, g'}}
                            ],
                            'should': [
                                {'match': {'authors.full_name': 'gersdorff, g'}}
                            ]
                        }
                    },
                    {
                        'bool': {
                            'must': [
                                {'match': {'authors.name_variations': 'von gersdorff, g'}}
                            ],
                            'should': [
                                {'match': {'authors.full_name': 'von gersdorff, g'}}                            ]
                        }
                    }
                ]
            }
        }
    }
    result = query.body

    assert expected == result
示例#22
0
def test_or_of_exactauthor_colon_queries():
    query = InspireQuery('exactauthor:X.Yin.1 or exactauthor:"Yin, Xi"')

    expected = {}
    result = query.body

    assert expected == result
示例#23
0
def test_google_style_or_google_style():
    query = InspireQuery('sungtae cho or 1301.7261')

    expected = {}
    result = query.body

    assert expected == result
示例#24
0
def test_fulltext_colon():
    query = InspireQuery('fulltext:TODO')

    expected = {}
    result = query.body

    assert expected == result
示例#25
0
def test_find_date():
    query = InspireQuery('fin date > today')

    expected = {}
    result = query.body

    assert expected == result
示例#26
0
def test_journal_colon():
    query = InspireQuery('journal:TODO')

    expected = {}
    result = query.body

    assert expected == result
示例#27
0
def test_find_report():
    query = InspireQuery('find r atlas-conf-*')

    expected = {}
    result = query.body

    assert expected == result
示例#28
0
def test_topcite_colon():
    query = InspireQuery('topcite:200+')

    expected = {}
    result = query.body

    assert expected == result
示例#29
0
def test_google_style_and_not_collaboration():
    query = InspireQuery("raffaele d'agnolo and not cn cms")

    expected = {}
    result = query.body

    assert expected == result
示例#30
0
def test_author_and_not_author():
    query = InspireQuery('a espinosa,jose r and not a rodriguez espinosa')

    expected = {}
    result = query.body

    assert expected == result