def sumOfProducts(query,page):
    """
    function to calculate SOP of the query for this page.
    :param query: query object
    :param page: page object
    :return: SOP of the entire query for that page
    """
    sop = 0
    for qword in query.getWordList():
        if qword in page.getWordList():
            sop = sop + query.getWordList()[qword] * page.getWordList()[qword]
    return sop