Subversion Repositories xrowsearch

[/] [trunk/] [classes/] [struct/] [xrowRecord.php] - Blame information for rev 1

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

Line No. Rev Author Line
1 1 rrobert
<?php
2
 
3
class xrowRecord implements ezcBasePersistable, ezcSearchDefinitionProvider
4
{
5
    public $meta_key;
6
    public $meta_guid;
7
    public $meta_name;
8
    public $url;
9
    public $text;
10
    public $meta_installation_id;
11
    public $meta_language_code;
12
 
13
 
14
    function __construct($meta_key=null, $installation_id = false, $language = 'ger-DE', $meta_guid = null, $meta_name = null, $url = null, $text = null )
15
    {
16
        if ( $meta_guid === null )
17
        {
18
            $this->meta_guid = uniqid();
19
        }
20
        else
21
        {
22
            $this->meta_guid = $meta_guid;
23
        }
24
        $this->meta_name = $meta_name;
25
        $this->url = $url;
26
        $this->meta_key = $meta_key;
27
        $this->text = $text;
28
        $this->meta_language_code = $language;
29
        $this->meta_installation_id = $installation_id;
30
    }
31
 
32
    static public function getDefinition()
33
    {
34
        $n = new ezcSearchDocumentDefinition( 'xrowSearch' );
35
 
36
        $n->idProperty = 'meta_guid';
37
        $n->fields['meta_installation_id'] = new ezcSearchDefinitionDocumentField( 'meta_installation_id', xrowSOLRHandler::MS );
38
        $n->fields['meta_language_code'] = new ezcSearchDefinitionDocumentField( 'meta_language_code', xrowSOLRHandler::MS );
39
        $n->fields['meta_guid'] = new ezcSearchDefinitionDocumentField( 'meta_guid', xrowSOLRHandler::MS );
40
        $n->fields['meta_key'] = new ezcSearchDefinitionDocumentField( 'meta_key', xrowSOLRHandler::KEY );
41
        $n->fields['meta_name'] = new ezcSearchDefinitionDocumentField( 'meta_name', ezcSearchDocumentDefinition::TEXT, 2, true, false, true );
42
        $n->fields['url'] = new ezcSearchDefinitionDocumentField( 'url', ezcSearchDocumentDefinition::STRING );
43
        $n->fields['text'] = new ezcSearchDefinitionDocumentField( 'text', ezcSearchDocumentDefinition::TEXT, 1, false, false, true );
44
        return $n;
45
    }
46
 
47
    function getState()
48
    {
49
        $state = array(
50
            'meta_installation_id' => $this->meta_installation_id ,
51
            'meta_language_code' => $this->meta_language_code ,
52
            'meta_guid' => $this->meta_guid ,
53
            'meta_key' => $this->meta_key ,
54
            'meta_name' => $this->meta_name ,
55
            'url' => $this->url ,
56
            'text' => $this->text
57
        );
58
        return $state;
59
    }
60
 
61
    public function setState( array $state )
62
    {
63
        foreach ( $state as $key => $value )
64
        {
65
            $this->$key = $value;
66
        }
67
    }
68
}