def createTagKeyword(item_id, first_name, last_name, token): """ Funzione temporanea utilizzata per creare una keyword contenente il nome della persona e associarla all'item in cui compare. Necessaria solo per la ricerca nella demo di sinnova! """ k1 = create_keyword(first_name, token) k2 = create_keyword(last_name, token) t1 = create_tag(item_id, k1['id'], 'keyword', token) t2 = create_tag(item_id, k2['id'], 'keyword', token)
def _create_or_retrieve_keyword(value, token=None): """ Function used in order to create a new keyword associate to the string value if it doesn't exist. Otherwise a already existing keyword is returned. :param value: String which must be associated to an item :return: A object corresponding to the keyword. """ # check if the keyword already exists k = search_keyword(value, token) # otherwise create a new one if not k: k = create_keyword(value, token) # return the keyword object return k