Plucen...ializer(3pm)

πŸ“¦
version 1.25 Β· 2 versions
  • 1.25 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.25 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Plucene::Document::DateSerializer(3pm) πŸ’–

okay so bestie, you know how Plucene::Document::DateSerializer is a thing? yeah. this is that page. it's the date-handling girlie of the Plucene universe and she is carrying the whole timeline on her back, no cap. πŸŽ€


✨ NAME ✨

Plucene::Document::DateSerializer β€” utility functions for dealing with dates πŸ¦‹


🌸 SYNOPSIS 🌸

like, here's the vibe in code form:

use Plucene::Document::DateSerializer
my $field = Plucene::Document::Field->Text(
        date => freeze_date(Time::Piece $t)
);
$doc->add($field);

that's it. that's the whole ritual. ✨


πŸ’œ DESCRIPTION πŸ’œ

okay so real talk: dates and times in Plucene should be serialized using the freeze_date function. why? because that's the whole point β€” it means Plucene::Search::DateFilter can actually filter on them during future searches. it's giving future-proofing. it's giving main character energy. do it this way or your dates are just out here unsearchable and sad. πŸ’…


🧚 SUBROUTINES 🧚

πŸ“ freeze_date

my $string = freeze_date(Time::Piece $t)

this routine is exported by default (yes queen, you get it for free 🫢). it takes a Time::Piece object and turns it into a string in a format that both Plucene and Lucene expect. so like, both sides of the friendship group are happy. iconic. πŸ‘‘

⭐ thaw_date

my Time::Piece $t = Plucene::Document::DateSerializer::thaw_date($string)

okay so this one is not exported, and also it's not used by the Plucene core. so what's the tea? it's useful for debugging dates, and it simply reverses the freeze_date operation. that's it. it's the undo button. it's the "wait let me check what I actually just did" function. 😭

heads up bestie: since it's not exported, you gotta call it the long way β€” Plucene::Document::DateSerializer::thaw_date($string). no shortcuts here. πŸ™ˆ

that's the whole page, babe. go freeze some dates and slay. πŸ’–

this was perl v5.36.0, dated 2022-12-04, straight from the User Contributed Perl Documentation. mwah. πŸ’‹

πŸ“¦ where this page comes from