コード例 #1
0
def test_author_colon_bai():
    query = IQ('author:Y.Nomura.1', LiteratureSearch())

    expected = {
        'bool': {
            'must': [{
                'bool': {
                    'should': [{
                        'match': {
                            u'authors.name_variations': 'Y.Nomura.1'
                        }
                    }, {
                        'term': {
                            u'authors.ids.value': 'Y.Nomura.1'
                        }
                    }]
                }
            }],
            'should': [{
                'match': {
                    u'authors.full_name': 'Y.Nomura.1'
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #2
0
def test_exactauthor():
    query = IQ('ea wu, xing gang')

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #3
0
def test_author_colon_with_double_quotes():
    query = IQ('author:"tachikawa, yuji"', LiteratureSearch())

    expected = {
        "bool": {
            "must": [{
                "bool": {
                    "should": [{
                        "match": {
                            "authors.name_variations": "tachikawa, yuji"
                        }
                    }, {
                        "term": {
                            "authors.ids.value": "tachikawa, yuji"
                        }
                    }]
                }
            }],
            "should": [{
                "match": {
                    "authors.full_name": "tachikawa, yuji"
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #4
0
def test_author_or_author():
    query = IQ('a fileviez perez,p or p. f. perez', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #5
0
def test_author_and_not_type_code():
    query = IQ('a nilles,h and not tc I', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #6
0
def test_author_bai():
    query = IQ('find a r.j.hill.1', LiteratureSearch())

    expected = {
        "bool": {
            "must": [{
                "bool": {
                    "should": [{
                        "match": {
                            "authors.name_variations": "r.j.hill.1"
                        }
                    }, {
                        "term": {
                            "authors.ids.value": "r.j.hill.1"
                        }
                    }]
                }
            }],
            "should": [{
                "match": {
                    "authors.full_name": "r.j.hill.1"
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #7
0
def test_find_type_code():
    query = IQ('find tc book', LiteratureSearch())

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

    assert expected == result
コード例 #8
0
def test_find_report():
    query = IQ('find r atlas-conf-*', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #9
0
def test_find_date():
    query = IQ('fin date > today', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #10
0
def test_find_country_code():
    query = IQ('find cc italy', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #11
0
def test_author_colon_bai_with_double_quotes_and_collection_colon():
    query = IQ('author:"E.Witten.1" AND collection:citeable',
               LiteratureSearch())

    expected = {
        'bool': {
            'must': [{
                'bool': {
                    'should': [{
                        'match': {
                            u'authors.name_variations': 'E.Witten.1'
                        }
                    }, {
                        'term': {
                            u'authors.ids.value': 'E.Witten.1'
                        }
                    }]
                }
            }, {
                'multi_match': {
                    'fields': ['collections.primary'],
                    'query': 'citeable'
                }
            }],
            'should': [{
                'match': {
                    u'authors.full_name': 'E.Witten.1'
                }
            }]
        }
    }

    result = query.to_dict()

    assert expected == result
コード例 #12
0
def test_author_bai():
    query = IQ('find a r.j.hill.1', LiteratureSearch())

    expected = {
        "bool": {
            "must": [
              {
                "bool": {
                  "should": [
                    {
                      "match": {
                        "authors.name_variations": "r.j.hill.1"
                      }
                    },
                    {
                      "term": {
                        "authors.ids.value": "r.j.hill.1"
                      }
                    }
                  ]
                }
              }
            ],
            "should": [
              {
                "match": {
                  "authors.full_name": "r.j.hill.1"
                }
              }
            ]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #13
0
def test_find_author_uppercase():
    query = IQ('FIND A W F CHANG', LiteratureSearch())

    expected = {
        "bool": {
            "must": [
              {
                "bool": {
                  "should": [
                    {
                      "match": {
                        "authors.name_variations": "W F CHANG"
                      }
                    },
                    {
                      "term": {
                        "authors.inspire_bai": "W F CHANG"
                      }
                    }
                  ]
                }
              }
            ],
            "should": [
              {
                "match": {
                  "authors.full_name": "W F CHANG"
                }
              }
            ]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #14
0
def test_author_and_not_author():
    query = IQ('a espinosa,jose r and not a rodriguez espinosa', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #15
0
def test_exactauthor():
    query = IQ('ea wu, xing gang')

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #16
0
def test_citedby_colon():
    query = IQ('citedby:foobar', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #17
0
def test_find_type_code():
    query = IQ('find tc book', LiteratureSearch())

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

    assert expected == result
コード例 #18
0
def test_journal_colon():
    query = IQ('journal:TODO', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #19
0
def test_find_exactauthor_not_affiliation_uppercase():
    query = IQ(
        'FIND EA RINALDI, MASSIMILIANO NOT AFF SINCROTRONE TRIESTE', LiteratureSearch())

    expected = {
        "bool": {
            "must_not": [
              {
                "multi_match": {
                  "query": "SINCROTRONE TRIESTE",
                  "fields": [
                    "authors.affiliations.value",
                    "corporate_author"
                  ]
                }
              }
            ],
            "must": [
              {
                "multi_match": {
                  "query": "RINALDI, MASSIMILIANO",
                  "fields": [
                    "exactauthor.raw",
                    "authors.full_name",
                    "authors.alternative_names",
                    "authors.inspire_bai"
                  ]
                }
              }
            ]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #20
0
def test_fulltext_colon():
    query = IQ('fulltext:TODO', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #21
0
def test_exactauthor_colon():
    query = IQ('ea:matt visser', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #22
0
def test_exactauthor_colon_and_collection_colon():
    query = IQ('ea: matt visser AND collection:citeable', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #23
0
def test_field_code_colon():
    query = IQ('fc: a', LiteratureSearch())

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

    assert expected == result
コード例 #24
0
def test_exactauthor_colon():
    query = IQ('ea:matt visser', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #25
0
def test_eprint_colon_without_arxiv():
    query = IQ('eprint:TODO', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #26
0
def test_citedby_colon_recid_colon():
    query = IQ('citedby:recid:902780', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #27
0
def test_author_colon_bai():
    query = IQ('author:Y.Nomura.1', LiteratureSearch())

    expected = {
        "bool": {
            "should": [
              {
                "match": {
                  "authors.name_variations": "Y.Nomura.1"
                }
              },
              {
                "match": {
                  "authors.full_name": "Y.Nomura.1"
                }
              },
              {
                "match": {
                  "authors.inspire_bai": "Y.Nomura.1"
                }
              }
            ]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #28
0
def test_journal_colon():
    query = IQ('journal:TODO', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #29
0
def test_citedby_colon_recid_colon():
    query = IQ('citedby:recid:902780', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #30
0
def test_topcite_colon():
    query = IQ('topcite:200+', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #31
0
def test_field_code_colon():
    query = IQ('fc: a', LiteratureSearch())

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

    assert expected == result
コード例 #32
0
def test_type_code_colon():
    query = IQ('tc: l', LiteratureSearch())

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

    assert expected == result
コード例 #33
0
def test_type_code_colon():
    query = IQ('tc: l', LiteratureSearch())

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

    assert expected == result
コード例 #34
0
def test_google_style_or_google_style():
    query = IQ('sungtae cho or 1301.7261', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #35
0
def test_google_style_and_not_collaboration():
    query = IQ("raffaele d'agnolo and not cn cms", LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #36
0
def test_find_exactauthor_not_affiliation_uppercase():
    query = IQ('FIND EA RINALDI, MASSIMILIANO NOT AFF SINCROTRONE TRIESTE',
               LiteratureSearch())

    expected = {
        "bool": {
            "must_not": [{
                "multi_match": {
                    "query": "SINCROTRONE TRIESTE",
                    "fields":
                    ["authors.affiliations.value", "corporate_author"]
                }
            }],
            "must": [{
                "multi_match": {
                    "query":
                    "RINALDI, MASSIMILIANO",
                    "fields": [
                        "exactauthor.raw", "authors.full_name",
                        "authors.alternative_names", "authors.ids.value"
                    ]
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #37
0
def test_find_report():
    query = IQ('find r atlas-conf-*', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #38
0
def test_find_author():
    query = IQ('find a polchinski', LiteratureSearch())

    expected = {
        "bool": {
            "must": [{
                "bool": {
                    "should": [{
                        "match": {
                            "authors.name_variations": "polchinski"
                        }
                    }, {
                        "term": {
                            "authors.ids.value": "polchinski"
                        }
                    }]
                }
            }],
            "should": [{
                "match": {
                    "authors.full_name": "polchinski"
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #39
0
def test_author_or_author():
    query = IQ('a fileviez perez,p or p. f. perez', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #40
0
def test_google_style_and_not_collaboration():
    query = IQ("raffaele d'agnolo and not cn cms", LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #41
0
def test_author_and_not_type_code():
    query = IQ('a nilles,h and not tc I', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #42
0
def test_find_author_uppercase():
    query = IQ('FIND A W F CHANG', LiteratureSearch())

    expected = {
        "bool": {
            "must": [{
                "bool": {
                    "should": [{
                        "match": {
                            "authors.name_variations": "W F CHANG"
                        }
                    }, {
                        "term": {
                            "authors.ids.value": "W F CHANG"
                        }
                    }]
                }
            }],
            "should": [{
                "match": {
                    "authors.full_name": "W F CHANG"
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #43
0
def test_author_colon_with_double_quotes():
    query = IQ('author:"tachikawa, yuji"', LiteratureSearch())

    expected = {
        "bool": {
            "must": [
              {
                "bool": {
                  "should": [
                    {
                      "match": {
                        "authors.name_variations": "tachikawa, yuji"
                      }
                    },
                    {
                      "term": {
                        "authors.inspire_bai": "tachikawa, yuji"
                      }
                    }
                  ]
                }
              }
            ],
            "should": [
              {
                "match": {
                  "authors.full_name": "tachikawa, yuji"
                }
              }
            ]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #44
0
def test_author():
    query = IQ('a kondrashuk', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #45
0
def test_citedby_colon():
    query = IQ('citedby:foobar', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #46
0
def test_author_bai_malformed():
    query = IQ('a r.j.hill.1', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #47
0
def test_eprint_colon_without_arxiv():
    query = IQ('eprint:TODO', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #48
0
def test_author_colon_bai():
    query = IQ('author:Y.Nomura.1', LiteratureSearch())

    expected = {
          'bool': {
            'must': [
              {
                'bool': {
                  'should': [
                    {
                      'match': {
                        u'authors.name_variations': 'Y.Nomura.1'
                      }
                    },
                    {
                      'term': {
                        u'authors.ids.value': 'Y.Nomura.1'
                      }
                    }
                  ]
                }
              }
            ],
            'should': [
              {
                'match': {
                  u'authors.full_name': 'Y.Nomura.1'
                }
              }
            ]
          }
        }
    result = query.to_dict()

    assert expected == result
コード例 #49
0
def test_exactauthor_colon_and_collection_colon():
    query = IQ('ea: matt visser AND collection:citeable', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #50
0
def test_author():
    query = IQ('a kondrashuk', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #51
0
def test_fulltext_colon():
    query = IQ('fulltext:TODO', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #52
0
def test_author_bai_malformed():
    query = IQ('a r.j.hill.1', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #53
0
def test_topcite_colon():
    query = IQ('topcite:200+', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #54
0
def test_find_caption():
    query = IQ('Diagram for the fermion flow violating process', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #55
0
def test_google_style_or_google_style():
    query = IQ('sungtae cho or 1301.7261', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #56
0
def test_find_country_code():
    query = IQ('find cc italy', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #57
0
def test_find_author():
    query = IQ('find a polchinski', LiteratureSearch())

    expected = {
        "bool": {
            "must": [
              {
                "bool": {
                  "should": [
                    {
                      "match": {
                        "authors.name_variations": "polchinski"
                      }
                    },
                    {
                      "term": {
                        "authors.inspire_bai": "polchinski"
                      }
                    }
                  ]
                }
              }
            ],
            "should": [
              {
                "match": {
                  "authors.full_name": "polchinski"
                }
              }
            ]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #58
0
def test_find_date():
    query = IQ('fin date > today', LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result
コード例 #59
0
def test_author_colon_bai_with_double_quotes_and_collection_colon():
    query = IQ('author:"E.Witten.1" AND collection:citeable',
               LiteratureSearch())

    expected = {
        "bool": {
            "should": [{
                "match": {
                    "authors.full_name": "E.Witten.1"
                }
            }],
            "must": [{
                "bool": {
                    "should": [{
                        "match": {
                            "authors.name_variations": "E.Witten.1"
                        }
                    }, {
                        "term": {
                            "authors.inspire_bai": "E.Witten.1"
                        }
                    }]
                }
            }, {
                "multi_match": {
                    "query": "citeable",
                    "fields": ["collections.primary"]
                }
            }]
        }
    }
    result = query.to_dict()

    assert expected == result
コード例 #60
0
def test_author_colon_or_eprint_without_keyword():
    query = IQ('author:"Takayanagi, Tadashi" or hep-th/0010101',
               LiteratureSearch())

    expected = {}
    result = query.to_dict()

    assert expected == result