public function saveSearchResults(QueryModel $query)
    {
        $adapter = $this->getConnection();
        $table = $this->getMainTable();

        $numResults     = $query->getNumResults();
        $isSpellchecked = (int) $query->getIsSpellchecked();

        $saveData = [
            'store_id'        => $query->getStoreId(),
            'query_text'      => $query->getQueryText(),
            'num_results'     => $numResults,
            'is_spellchecked' => $isSpellchecked,
        ];

        $updateData = ['num_results' => $numResults, 'is_spellchecked' => $isSpellchecked];

        $adapter->insertOnDuplicate($table, $saveData, $updateData);
    }