# RAG Product Matching - User Guide

## Overview

The RAG (Retrieval Augmented Generation) Product Matching page allows you to scan document directories for product IDs and match them to database product records.

## Access

Navigate to: **Preferences → Forms → nc-rag**

## Features

### Product Match Tab

Scan directories for product documentation and automatically match product IDs found in files.

#### Options

| Option | Description | Default |
|--------|-------------|---------|
| Document path | Root directory to scan | `/Volumes/stu/_data/va-varuste/` |
| File type | File extension to process | `.pdf` |
| Max depth | Directory traversal depth | `10` |

#### Actions

- **Start Match** - Begin scanning the document directory
- **Search** - Filter results by text
- **Show Preview** - Toggle content preview display

### Results Grid

The results grid shows matched files with the following columns:

| Column | Description |
|--------|-------------|
| File path | Full path to the document |
| Product ID | Matched product ID |
| Product name | Product name from database |
| Matches | Number of product IDs found |
| Depth | Directory depth level |
| Folder | Top-level folder name |

## Usage

### Basic Workflow

1. **Set Document Path** - Enter the root directory to scan
2. **Select File Type** - Choose `.pdf`, `.txt`, `.md`, or `all`
3. **Set Max Depth** - Choose how deep to scan (1-10 levels)
4. **Click "Start Match"** - Begin the scanning process
5. **View Results** - Matched files appear in the grid below

### Filtering Results

Use the **Search** field to filter results by:

- File path
- Product ID
- Product name

### Viewing Product List

Switch to the **Product List** tab to see all products in the database.

## Product ID Format

Product IDs follow this pattern: `PREFIX_DESCRIPTION`

- **PREFIX**: 2-7 uppercase letters
- **SEPARATOR**: Underscore (`_`)
- **DESCRIPTION**: 1-50 uppercase letters, digits, or underscores

### Examples

- `VK_SAX400BTC`
- `TU_SAX320GTC25FFPMAGS`
- `RE_PINETREE`

## Tips

- Start with a small directory to test your settings
- Use "Show Preview" to see the extracted content
- Filter by product ID to find specific documentation
- Check the status message for processing results
