NAME
AmberDB::Index - Indexing and URL Rewrite Engine for AmberDB
SYNOPSIS
use parent qw(
...
AmberDB::Index
...
);
# Facet indexing
$dbp->facet_add($table_path, $table_info, \@records);
$dbp->facet_modify($table_path, $table_info, \@pairs);
$dbp->facet_del($table_path, $table_info, \@records);
# Field matching index (.fld)
$dbp->match_add($table_path, $table_info, \@records);
$dbp->match_modify($table_path, $table_info, \@pairs);
$dbp->match_del($table_path, $table_info, \@records);
# Full-text search index (.src)
$dbp->search_add($table_path, $table_info, $tableid, \@records);
$dbp->search_modify($table_path, $table_info, $tableid, \@pairs);
$dbp->search_del($table_path, $table_info, $tableid, \@records);
# Record primary index (.inx)
$dbp->records_add($table_path, $table_info, $tableid, \@new_rids);
$dbp->records_del($table_path, $table_info, \@del_rids);
# SEO URL rewrite mapping (.rwt)
my $slug = $dbp->set_seourl($table, $record, $write);
my $links = $dbp->get_seourl($table, $type, @records_ids);
DESCRIPTION
AmberDB::Index provides flat-file database indexing and SEO URL rewriting mechanisms for AmberDB. It manages inverted search indexes (.src), field match indexes (.fld), primary key listing indexes (.inx), and bidirectional URL rewrite maps (.rwt). Facet filtering indexes (.fac) and menu generation are handled by AmberDB::Index::Facet.
METHODS
field_to_list($value)
Converts ARRAY references, comma/semicolon delimited strings, or scalar values into a list of items.
repeat_fields($table_info, @record)
Consolidates repeated fields defined in $table_info->{repeat_ids} into a comma-separated value.
match_add / match_modify / match_del
Manages field-level exact match index files (.fld).
search_add / search_modify / search_del
Manages full-text search word inverted index files (.src).
records_add / records_del
Updates keys, count, and lastid in .inx primary index files.
sort_add / sort_modify / sort_del
Manages binary pre-sorted record index files (.srt) configured in $table_info->{sort_block}.
normalize_sort_key($value, $type, $len)
Normalizes a block value into a fixed-width sort key: - num / decimal: Adds 1e12 (1,000,000,000,000) offset for signed float/integer monotonic sorting (%020.6f). - string: Converts to ASCII, removes non-alphanumeric characters, truncates to 8 bytes (or custom $len), and pads with spaces. - date: Converts to 14-character YYYYMMDDHHMMSS timestamps.
set_seourl / get_seourl
Generates, stores, and resolves ASCII-clean SEO URL rewrite slugs in _0.rwt and _1.rwt maps.
AUTHOR
Maruf Cetin <marufcetin@gmail.com>
LICENSE AND COPYRIGHT
Copyright (C) 2006-2026 Maruf Cetin.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.