I am working on creating a keyword search. The first code "Creating a child with all created keywords here" saves how I would like it too where each keyword is assigned a "key" (First Picture). Yet, for the second part of the code where I am saving the "values" of the "post" I want to save the keywords that are written in the post as a child "keywords" with each keyword assigned a key. The way the second part of the code saves keywords is (second picture).
The problem is when I am saving my "values" (second piece of code) how can I set the keywords I am saving to have matching "keys" instead of zero's and one's.
Creating a child with all created keywords here / Saves how I want
let caption = self.postCaption.text
let hashtag = caption?.split{$0 == " "}.map(String.init)
    for item in hashtag! {
        if item.contains("#") {
            self.keywords.append(item)
            print(self.keywords)
            Database.database().reference().child("Keywords").childByAutoId().setValue(item)
        } else {
            print("There are no keywords for this post")
        }
    }
Saving keywords from post caption here to "post" as a child / does not save how I want
        photoRef.child("\(imageName)").putData(data!, metadata: nil) { (metaData,error) in
        if let error = error {
            print("there was an error")
            print(error.localizedDescription)
            return
        } else {
            // store downloadURL
            photoRef.child("\(imageName)").downloadURL(completion: {(url, error) in
                if error != nil {
                    print(error!.localizedDescription)
                    return
                }
                let downloadURL = url?.absoluteString
                let values: Dictionary<String, Any> = ["Keywords":self.keywords, "onesignal":self.loggedInUserData?["onesignal"] as! String,"employeeName":self.loggedInUserData?["name"] as! String,"employeeEmail":self.loggedInUserData?["email"] as! String,"uid": uid, "caption": caption ?? "", "download_url": downloadURL, "timestamp": Int(Date().timeIntervalSince1970), "businessName":self.otherUser?["businessName"] as! String, "businessStreet":self.otherUser?["businessStreet"] as! String, "businessCity":self.otherUser?["businessCity"] as! String, "businessState":self.otherUser?["businessState"] as! String, "businessZIP":self.otherUser?["businessZIP"] as! String, "businessLatitude":self.otherUser?["businessLatitude"] as! String, "businessLongitude":self.otherUser?["businessLongitude"] as! String, "imageID": imageName, "postID": postID, "businessUID":self.otherUser?["uid"] as! String]
                // store downloadURL at database
                let databaseRef = Database.database().reference()
                let path = databaseRef.child("Businesses").child(self.otherUser?["uid"] as! String).child("posts_requests").childByAutoId()
                path.setValue(values) { (error, ref) -> Void in
                    if error != nil {
                        print("error saving post in db")
                    } else {
                        // reset caption field
                        self.postCaption.text = ""
                        // reset placeholder image
                        self.imageView.image = UIImage(named: "filterPlaceholder")
                        MBProgressHUD.hide(for: self.view, animated: true)
                        let viewConrolller = self.storyboard?.instantiateViewController(withIdentifier: "Employee Profile") as! UITabBarController
                        self.present(viewConrolller, animated: true, completion: nil)
                    }
                }
            })
        }
    }


 
    