Subversion Repositories xrowsearch

[/] [trunk/] [classes/] [struct/] [xrowRecord.php] - Rev 1

Go to most recent revision | Compare with Previous | Blame | View Log

<?php

class xrowRecord implements ezcBasePersistable, ezcSearchDefinitionProvider
{
    public $meta_key;
    public $meta_guid;
    public $meta_name;
    public $url;
    public $text;
    public $meta_installation_id;
    public $meta_language_code;
   

    function __construct($meta_key=null, $installation_id = false, $language = 'ger-DE', $meta_guid = null, $meta_name = null, $url = null, $text = null )
    {
        if ( $meta_guid === null )
        {
            $this->meta_guid = uniqid();
        }
        else
        {
            $this->meta_guid = $meta_guid;
        }
        $this->meta_name = $meta_name;
        $this->url = $url;
        $this->meta_key = $meta_key;
        $this->text = $text;
        $this->meta_language_code = $language;
        $this->meta_installation_id = $installation_id;
    }

    static public function getDefinition()
    {
        $n = new ezcSearchDocumentDefinition( 'xrowSearch' );
       
        $n->idProperty = 'meta_guid';
        $n->fields['meta_installation_id'] = new ezcSearchDefinitionDocumentField( 'meta_installation_id', xrowSOLRHandler::MS );
        $n->fields['meta_language_code'] = new ezcSearchDefinitionDocumentField( 'meta_language_code', xrowSOLRHandler::MS );
        $n->fields['meta_guid'] = new ezcSearchDefinitionDocumentField( 'meta_guid', xrowSOLRHandler::MS );
        $n->fields['meta_key'] = new ezcSearchDefinitionDocumentField( 'meta_key', xrowSOLRHandler::KEY );
        $n->fields['meta_name'] = new ezcSearchDefinitionDocumentField( 'meta_name', ezcSearchDocumentDefinition::TEXT, 2, true, false, true );
        $n->fields['url'] = new ezcSearchDefinitionDocumentField( 'url', ezcSearchDocumentDefinition::STRING );
        $n->fields['text'] = new ezcSearchDefinitionDocumentField( 'text', ezcSearchDocumentDefinition::TEXT, 1, false, false, true );
        return $n;
    }

    function getState()
    {
        $state = array(
            'meta_installation_id' => $this->meta_installation_id ,
            'meta_language_code' => $this->meta_language_code ,
            'meta_guid' => $this->meta_guid ,
            'meta_key' => $this->meta_key ,
            'meta_name' => $this->meta_name ,
            'url' => $this->url ,
            'text' => $this->text
        );
        return $state;
    }

    public function setState( array $state )
    {
        foreach ( $state as $key => $value )
        {
            $this->$key = $value;
        }
    }
}

Go to most recent revision | Compare with Previous | Blame | View Log