From 9ba910e84dad5cebbe3d3d3014d5100f62e88477 Mon Sep 17 00:00:00 2001 From: Murad Khan Date: Tue, 15 Jan 2019 12:55:35 -0500 Subject: [PATCH] Add tld to search grammar --- pydat/pydat/handlers/advanced_es.py | 21 ++++++++++------ pydat/pydat/handlers/parsetab.py | 38 ++++++++++++++--------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/pydat/pydat/handlers/advanced_es.py b/pydat/pydat/handlers/advanced_es.py index 3a72680..1535aa3 100755 --- a/pydat/pydat/handlers/advanced_es.py +++ b/pydat/pydat/handlers/advanced_es.py @@ -151,7 +151,13 @@ def __repr__(self): 'details.administrativeContact_fax', 'details.administrativeContact_faxExt', 'details.administrativeContact_telephone', - 'details.administrativeContact_telephoneExt' + 'details.administrativeContact_telephoneExt', + 'tld' +] + +toplevel_keywords = [ + 'domainName', + 'tld' ] date_keywords = { @@ -195,7 +201,8 @@ def __repr__(self): 'contactEmail', 'nameServers', 'registrarName', - 'whoisServer' + 'whoisServer', + 'tld' ] special_keywords = { @@ -352,7 +359,7 @@ def create_specific_word_subquery(key, value): if key in shortcut_keywords: fields1 = shortcut_keywords[key] elif key in original_keywords: - if key != 'domainName': + if key not in toplevel_keywords: key = 'details.' + key fields1 = [key] else: @@ -425,7 +432,7 @@ def p_specific_fuzzy_quoted(t): if key in shortcut_keywords: fields1 = shortcut_keywords[key] elif key in original_keywords: - if key != 'domainName': + if key not in toplevel_keywords: key = 'details.' + key fields1 = [key] else: @@ -467,7 +474,7 @@ def p_specific_quoted(t): if key in shortcut_keywords: fields1 = shortcut_keywords[key] elif key in original_keywords: - if key != 'domainName': + if key not in toplevel_keywords: key = 'details.' + key fields1 = [key] else: @@ -520,7 +527,7 @@ def p_field_missing(t): if key in shortcut_keywords: fields = shortcut_keywords[key] elif key in original_keywords: - if key != 'domainName': + if key not in toplevel_keywords: key = 'details.' + key fields = [key] else: @@ -545,7 +552,7 @@ def create_wildreg_query(key, value, qtype): if key in shortcut_keywords: fields1 = shortcut_keywords[key] elif key in original_keywords: - if key != 'domainName': + if key not in toplevel_keywords: key = 'details.' + key fields1 = [key] else: diff --git a/pydat/pydat/handlers/parsetab.py b/pydat/pydat/handlers/parsetab.py index a116a56..a81017f 100644 --- a/pydat/pydat/handlers/parsetab.py +++ b/pydat/pydat/handlers/parsetab.py @@ -27,23 +27,23 @@ del _lr_goto_items _lr_productions = [ ("S' -> query","S'",1,None,None,None), - ('query -> LPAREN query RPAREN','query',3,'p_query_group','advanced_es.py',289), - ('query -> NOT query','query',2,'p_query_not','advanced_es.py',294), - ('query -> query query','query',2,'p_query_query','advanced_es.py',317), - ('query -> query AND query','query',3,'p_query_and_query','advanced_es.py',322), - ('query -> query OR query','query',3,'p_query_or_query','advanced_es.py',327), - ('query -> specific','query',1,'p_query_terminals','advanced_es.py',341), - ('query -> daterange','query',1,'p_query_terminals','advanced_es.py',342), - ('query -> termquery','query',1,'p_query_terminals','advanced_es.py',343), - ('specific -> FUZZY WORD COLON WORD','specific',4,'p_specific_fuzzy_word','advanced_es.py',379), - ('specific -> WORD COLON WORD','specific',3,'p_specific_word','advanced_es.py',396), - ('specific -> FUZZY WORD COLON QUOTED','specific',4,'p_specific_fuzzy_quoted','advanced_es.py',408), - ('specific -> WORD COLON QUOTED','specific',3,'p_specific_quoted','advanced_es.py',453), - ('specific -> WORD COLON NULL','specific',3,'p_field_missing','advanced_es.py',512), - ('specific -> WORD COLON WILDCARD','specific',3,'p_specific_wildcard','advanced_es.py',580), - ('specific -> WORD COLON REGEX','specific',3,'p_specific_regex','advanced_es.py',589), - ('daterange -> WORD COLON DATE','daterange',3,'p_daterange_single','advanced_es.py',614), - ('daterange -> WORD COLON DATE COLON DATE','daterange',5,'p_daterange_range','advanced_es.py',627), - ('termquery -> QUOTED','termquery',1,'p_termquery_quoted','advanced_es.py',643), - ('termquery -> WORD','termquery',1,'p_termquery_word','advanced_es.py',696), + ('query -> LPAREN query RPAREN','query',3,'p_query_group','advanced_es.py',296), + ('query -> NOT query','query',2,'p_query_not','advanced_es.py',301), + ('query -> query query','query',2,'p_query_query','advanced_es.py',324), + ('query -> query AND query','query',3,'p_query_and_query','advanced_es.py',329), + ('query -> query OR query','query',3,'p_query_or_query','advanced_es.py',334), + ('query -> specific','query',1,'p_query_terminals','advanced_es.py',348), + ('query -> daterange','query',1,'p_query_terminals','advanced_es.py',349), + ('query -> termquery','query',1,'p_query_terminals','advanced_es.py',350), + ('specific -> FUZZY WORD COLON WORD','specific',4,'p_specific_fuzzy_word','advanced_es.py',386), + ('specific -> WORD COLON WORD','specific',3,'p_specific_word','advanced_es.py',403), + ('specific -> FUZZY WORD COLON QUOTED','specific',4,'p_specific_fuzzy_quoted','advanced_es.py',415), + ('specific -> WORD COLON QUOTED','specific',3,'p_specific_quoted','advanced_es.py',460), + ('specific -> WORD COLON NULL','specific',3,'p_field_missing','advanced_es.py',519), + ('specific -> WORD COLON WILDCARD','specific',3,'p_specific_wildcard','advanced_es.py',587), + ('specific -> WORD COLON REGEX','specific',3,'p_specific_regex','advanced_es.py',596), + ('daterange -> WORD COLON DATE','daterange',3,'p_daterange_single','advanced_es.py',621), + ('daterange -> WORD COLON DATE COLON DATE','daterange',5,'p_daterange_range','advanced_es.py',634), + ('termquery -> QUOTED','termquery',1,'p_termquery_quoted','advanced_es.py',650), + ('termquery -> WORD','termquery',1,'p_termquery_word','advanced_es.py',703), ]