-
Notifications
You must be signed in to change notification settings - Fork 0
Method field_fetch
marufcetin edited this page Sep 1, 2026
·
1 revision
Turkce Dokumantasyon | English Documentation
Category: Query & Search Methods
Submodule:AmberDB
Entry Type: Inverted Index Exact Matching
field_fetch() fetches records matching one or more specific block values by querying the inverted exact-match index (.fld). It supports multi-value queries, automatic ID deduplication, sorting, pagination, and keys_only scalar pipelines. If match_block is not configured in the schema, it automatically falls back to a sequential table scan.
# 1. Unpaginated
my @records = $adb->field_fetch($table_id, $block, $value, [$start], [$limit], [%options]);
# 2. Paginated (when limit > 0)
my ($total_count, @records) = $adb->field_fetch($table_id, $block, $value, $start, $limit, [%options]);| Parameter / Option | Type | Required | Description |
|---|---|---|---|
$table_id |
String | Required | Target table name. |
$block |
Integer | Required | 1-based block index defined in schema match_block. |
$value |
Scalar / List | Required | Target value to match. Supports comma-separated strings ("5, 12") or array references (["5", "12"]). |
start / limit
|
Integer | Optional | Pagination offset and limit count. |
sort |
Int / Hash | Optional | Sorting block index (e.g. sort => -10 for ascending on block 10). |
keys_only |
Boolean | Optional | If 1, skips record deserialization and returns only matching IDs. |
jnktype |
String | Optional | Tier mode ('A', 'B', 'AB'). |
Important
Paginated vs Unpaginated Returns:
- When
$limit > 0, returns($total_count, @records). - When unpaginated (
$limitomitted or 0), returns@recordsdirectly.
# 1. Fetch all products belonging to Category 5 (Block 1)
my @category_5_products = $adb->field_fetch("catalog_product", 1, "5");
# 2. Multi-value query with pagination and sorting
my ($total, @page) = $adb->field_fetch(
"catalog_product", 1, [ "5", "8" ],
0, 20,
sort => -3 # Sort by Price (Block 3) ascending
);
# 3. Fast keys_only ID extraction
my ($count, @matching_ids) = $adb->field_fetch("catalog_product", 1, "5", 0, 50, keys_only => 1);AmberDB — High-Performance Schema-Driven NoSQL Database Engine for Perl.
Copyright 2005-2026 Maruf Cetin. Released under the Artistic License 2.0.
CPAN · GitHub Repository · Issue Tracker
- Berkeley DB (DB_File) Engine
- AmberDB Table Schema
- Global Flags
- Table Schema Flags
- Directory Structure
- File Structure (Extensions)
- Repeat Blocks
- Auto-Increment ID
- ASCII ID
- Relational Records
- Record Anatomy
- JOIN-Free Architecture
- Packed Binary Index
- Strict 2PL Locking
- Undo Journal & Rollback
- Tiered Junk Indexing
- Disjunctive Faceting
- Phonetic Accent Search
- 2-Pillar Disaster Recovery
- RAM-Disk Acceleration
- In-Memory Schema Mutation
- Simple Mode
- new
- config
- set_datadir
- insert_id
- insert_list
- modify_id
- modify_list
- delete_id
- delete_list
- read_id
- read_all
- read_list
- exist_id
- exist_list
- exist_table
- table_count
- table_keys
- table_lastid
- table_attr
- table_create
- field_fetch
- field_filter
- search_table
- facet_menu
- field_fltkeys
- field_allfltkeys
- facet_rules
- slug_read
- slug_fetch
- transact_start
- transact_end
- transact_commit
- transact_rollback
- transact_recover
- flock_open
- flock_close
- cache_setup
- cache_read
- cache_write
- cache_delete
- cache_preload
- cache_ensure
- buffer_write
- buffer_read
- buffer_delete
- recs_scan
- recs_get
- recs_put
- recs_del
- locale_uc
- locale_lc
- locale_sort
- locale_to_ascii
- locale_num2text
- locale_format_currency
- locale_format_date
- array_sort
- array_punch
- array_filter
- array_sublist
- deep_copy
- log_owner
- use_counter
- use_junk
- keep_deleted
- auto_id
- buffer_write
- simple
- no_write
- no_backup
- jnktype
- keys_only
- id_type
- language
- .db · .table · .dbase
- .inx · .fld · .src
- .fac · .srt · .slg
- .unq · .del · .aut
- .cnt · .txn · .amberdb
- .csv · .cache · .tmp