Exemplo n.º 1
0
 def query_class(self, DefaultQueryClass):
     """
     Given the default Query class, returns a custom Query class
     to use for this backend. Returns None if a custom Query isn't used.
     See also BaseDatabaseFeatures.uses_custom_query_class, which regulates
     whether this method is called at all.
     """
     return query.query_class(DefaultQueryClass)
Exemplo n.º 2
0
def parsing_query(filename):
    with open(filename, "r") as ff:
        index_num = []
        queries_list = []
        new_queries = []
        query_docs = []  #list containing class of queries
        tracker = False
        sen_add = ""
        for line in ff:
            #      print(line)
            if ".I" in line:
                tracker = False  # the tracker has a true value untill another instance of the line containing .W
                if len(sen_add) > 0:
                    #          print(sen_add)
                    queries_list.append(sen_add)
                sen_add = ""
                part = line.split()
                #        print(part)
                index_num.append(part[1])
            if ".W" in line:
                tracker = True  # the tracker has a true value untill another instance of the line containing .I
            if tracker == True:
                sen_add = sen_add + line
        if len(sen_add) > 0:
            queries_list.append(sen_add)
        for query in queries_list:
            query = query[2:]
            new_queries.append(query)
        length_num = len(index_num)
        for counter in range(length_num):
            I = index_num[counter]
            qu = new_queries[counter]
            query_docs.append(query_class(I, qu))
        ff.close()
        #    print(len(queries))
        return query_docs
Exemplo n.º 3
0
 def query_class(self, DefaultQueryClass):
     return query.query_class(DefaultQueryClass)