Sphinx\SphinxClient::flushAttributes PHP Method

flushAttributes() public method

Forces searchd to flush pending attribute updates to disk, and blocks until completion
public flushAttributes ( ) : integer
return integer Flush tag, -1 on error.
    public function flushAttributes()
    {
        $this->mbPush();
        if (!($fp = $this->connect())) {
            $this->mbPop();
            return -1;
        }
        // len=0
        $req = pack('nnN', self::SEARCHD_COMMAND_FLUSHATTRS, self::VER_COMMAND_FLUSHATTRS, 0);
        if (!$this->send($fp, $req, 8) || !($response = $this->getResponse($fp, self::VER_COMMAND_FLUSHATTRS))) {
            $this->mbPop();
            return -1;
        }
        $tag = -1;
        if (strlen($response) === 4) {
            list(, $tag) = unpack('N*', $response);
        } else {
            $this->error = 'unexpected response length';
        }
        $this->mbPop();
        return $tag;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function flushAttributes()
 {
     return $this->proxy->flushAttributes();
 }