Pricing Database

Manage product pricing data with smart search, natural-language price detection, and dynamic schema support.

Who can access this?

editor manager superadmin

Overview

The Pricing Database stores structured product pricing information. It supports full-text search via FTS5, semantic search via VectorDB, and smart price-range detection that understands natural language queries like "harga antara 200 juta sampai 300 juta".

Default Fields

FieldTypeRequiredFTS WeightDescription
product_name Text Required 2.0 (highest) Product display name — primary search field
sku Text Optional 1.0 Stock keeping unit / product code
price Real Required Numeric price value (not FTS-indexed)
currency Text Optional 0.5 Currency code (default: IDR)
unit Text Optional 0.5 Pricing unit (default: unit)
category Text Optional 1.5 Product category for grouping and filtering
description Text Optional 1.0 Product description
Custom Fields

superadmin users can add custom fields via the Schema Editor. Each field's FTS weight and VectorDB template are configurable.

erDiagram PRICING { int id PK "Auto-increment" text product_name "Required, FTS weight 2.0" text sku "Optional, FTS weight 1.0" real price "Required, not FTS-indexed" text currency "Default: IDR" text unit "Default: unit" text category "FTS weight 1.5" text description "FTS weight 1.0" int vectordb_synced "0 or 1" text last_updated "Timestamp" }

Table View

The pricing page shows all records in a paginated, searchable table.

Pricing table
Screenshot: Pricing data table with search bar, category filter, and pagination

Search Behavior

The search box uses FTS5 full-text search. It searches across these fields (with different weights):

flowchart LR Q[ Search Query] --> FTS[FTS5 Engine] FTS --> F1["product_name
weight 2.0"] FTS --> F2["category
weight 1.5"] FTS --> F3["sku
weight 1.0"] FTS --> F4["description
weight 1.0"] style Q fill:#3B82F6,color:#fff style F1 fill:#22C55E,color:#fff style F2 fill:#84CC16,color:#fff

Fields with higher FTS weights rank higher in search results. For example, searching "Honda Veloz" will prioritize records where "Honda Veloz" appears in product_name (weight 2.0) over those where it only appears in description (weight 1.0).

Filters & Controls

Smart Price-Range Detection

When users search via the query API (or the widget), BABEH automatically detects price-related natural language and converts it into numeric filters. This works in Indonesian and English.

PatternExampleInterpretation
Explicit range "antara 200 juta sampai 300 juta" 200,000,000 ≤ price ≤ 300,000,000
Upper bound "budget 500 juta" / "dibawah 1 miliar" price ≤ 500,000,000
Lower bound "diatas 200 juta" price ≥ 200,000,000
Approximate "sekitar 300 juta" 240,000,000 ≤ price ≤ 360,000,000 (±20%)
Unit Parsing

Indonesian currency units are automatically converted:
miliar = 1,000,000,000  |  juta = 1,000,000  |  ribu = 1,000

Add / Edit / Delete Records

Adding a Record

  1. Click the "+ Add" button above the table.
  2. A modal appears with a dynamic form generated from the current schema.
  3. Fill in the required fields (marked with a red asterisk).
  4. Click Save. The record is validated against the schema before saving.
Add pricing modal
Screenshot: Add/Edit pricing record modal with dynamic form fields

Editing a Record

Click the Edit button on any row to open the edit modal. The form is pre-populated with current values. Modify fields and click Save.

Deleting a Record

Click the Delete button on a row. A confirmation dialog appears. Once confirmed, the record is permanently deleted.

Import & Export

Import CSV

  1. Click "Import" → select CSV tab.
  2. Choose a CSV file. Column headers must match the schema field names (e.g., product_name, price, category).
  3. The system maps columns by name and validates each row against the schema.
  4. A summary shows how many records were imported successfully.

Import JSON

Accepts two formats:

Export

VectorDB Sync

Pricing records can be indexed in ChromaDB for semantic search, allowing the AI to find relevant pricing when users ask natural-language questions.

  1. Click the "Sync VectorDB" button at the top of the pricing page.
  2. All records are processed: a text representation is generated from the VectorDB template in the schema, then embedded.
  3. The vectordb_synced flag is set to 1 for each synced record.
When to Sync

You should sync VectorDB after:

  • Importing new records
  • Making bulk edits
  • Changing the VectorDB template in the Schema Editor

Truncate (Empty Database)

Destructive Action

The "Truncate" button deletes ALL pricing records permanently. This action cannot be undone. Export your data first if you need a backup.

Only use this when you want to start fresh — for example, before a complete data reimport.