Changeset 440

Show
Ignore:
Timestamp:
10/05/07 18:06:41 (1 year ago)
Author:
ogawa
Message:

Add entry metadata as attributes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • EstCrawler/trunk/EstCrawler/EstCrawler.pl

    r439 r440  
    245245    my $cdate = ts2iso($entry->blog, $entry->authored_on); 
    246246    my $mdate = ts2iso($entry->blog, $entry->modified_on); 
     247    my $categories = join('', map { '[' . $_->label . ']' } @{$entry->categories}) 
     248        if $entry->categories; 
     249    my $tags = join('', map { '[' . $_ . ']' } $entry->tags) 
     250        if $entry->tags; 
    247251 
    248252    # metainfo (attribute, not searchable) 
     
    252256    $doc->add_attr('@cdate', $cdate); 
    253257    $doc->add_attr('@mdate', $mdate); 
     258    $doc->add_attr('entry_id', $entry->id); 
     259    $doc->add_attr('blog_id', $entry->blog_id); 
     260    $doc->add_attr('categories', $categories) if $categories; 
     261    $doc->add_attr('tags', $tags) if $tags; 
    254262 
    255263    # document body (searchable) 
     
    260268    $doc->add_hidden_text($title); 
    261269    $doc->add_hidden_text($author); 
    262     $doc->add_hidden_text(join(', ', map { $_->label } @{$entry->categories}) || ''); 
    263     $doc->add_hidden_text(join(', ', $entry->tags) || ''); 
     270    $doc->add_hidden_text($categories || ''); 
     271    $doc->add_hidden_text($tags || ''); 
    264272    $doc->add_hidden_text(remove_html($entry->keywords) || ''); 
    265273    $doc;