Skip to content

Commit 6211ced

Browse files
authored
Merge pull request #9 from ABCD-DEVCOM/facets-tutorial
Learn more about using facets (filters).
2 parents 8db6c4c + 649567a commit 6211ced

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

docs/abcd-modules/opac-abcd/opac-admin/3-databases/facets.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,31 @@ sidebar_position: 2
88

99
Facets are the side filters that appear after a search (e.g., "Filter by Year", "Filter by Author"). They allow users to refine a broad search into a specific set of records by grouping results based on common values.
1010

11-
**Script:** `facetas_cnf.php`
12-
**File Created:** `bases/[db]/opac/[lang]/[db]_facetas.dat`
11+
![View of the facets.](../../../../media/abcd-modules/opac-abcd/opac-admin/facetas_view.png)
12+
13+
14+
Script for creating facets:
15+
* **Script:** `facetas_cnf.php`
16+
* **File Created:** `bases/[db]/opac/[lang]/[db]_facetas.dat`
1317

1418
## 1. How Facets Work
1519
Facets rely on a combination of the **Inverted File (Index)** for counting and the **Master File** for display.
1620
* **Prerequisite:** You cannot create a facet for a field that is not indexed in the database's **FST** (Field Selection Table).
1721
* **Technique:** Ideally, fields used for facets should be indexed using **Technique 0 (Line)**.
1822

23+
To edit the facets, go to the ABCD Settings menu -> OPAC -> Under "Databases," select one of the available databases -> Click on the database, then in the top menu, under “Search,” locate "Facets."
24+
25+
![Config Facets](../../../../media/abcd-modules/opac-abcd/opac-admin/facetas_config.png)
26+
27+
1928
## 2. Configuration Columns
2029

2130
The configuration file is a pipe-delimited text file where each line represents a facet box. The interface allows you to define 4 specific columns:
2231

2332
| Column | Name | Description | Example |
2433
| :--- | :--- | :--- | :--- |
2534
| **1** | **Label** | The title of the facet box displayed to the user. | `Authors` |
26-
| **2** | **Extraction Format** | A mini-PFT (ISIS Format) to extract the value from the record. **Crucial:** Use `/` at the end to handle repetitive fields correctly. | `v100^a/` |
35+
| **2** | **Extraction Format** | A mini-PFT (ISIS Format) to extract the value from the record. **Crucial:** Use `/` at the end to handle repetitive fields correctly. Use parentheses ( ) if it is a repetitive field, that is, one that contains more than one instance of the same information. | `(v100^a/)` |
2736
| **3** | **Prefix** | The FST prefix used to filter the search when the user clicks a term. | `AU_` |
2837
| **4** | **Sort Order** | Defines how the terms inside the facet box are sorted.<br/>**Q**: By Quantity (Highest count first).<br/>**A**: Alphabetical order (A-Z). | `Q` |
2938

@@ -49,12 +58,21 @@ Subject (Topic)|v650^a/|MA_|Q
4958
* **Format:** `v100^a/` (Extracts subfield `^a`. The `/` ensures that if a book has 3 authors, 3 separate lines are generated).
5059
* **Prefix:** `AU_` (Matches the FST index).
5160
* **Sort:** `Q` (Shows the most prolific authors at the top).
52-
53-
5461
* **Row 3 (Year):**
5562
* **Sort:** `A` (Alphabetical/Numerical). This is better for dates, so the years appear as 1990, 1991, 1992, rather than by popularity.
5663

64+
For facets to work, the output format—that is, the format that generates the link in the facet blocks—must have the same structure as the data in the index.
65+
If you configure the display to show “Last Name, First Name” with the prefix AU_, and this is a combination of a field and a subfield, the FST must be indexed as “AU_Last Name, First Name”.
5766

67+
:::danger Warning!
68+
The | pipe character, used for concatenation in the FST, does not work in the facet display format.
69+
70+
Therefore, if the FST contains:
71+
`(|AU_|v160^*,|, |v160^b,'%'/)`
72+
In the facets, the pipe must be replaced with `'` (single quotes), so the format becomes:
73+
`(|AU_|v160^*,', 'v160^b,/)`
74+
Remove the percent sign as well; it does not work as a display format.
75+
:::
5876

5977
## 4. Helper: The FST Viewer
6078

79.7 KB
Loading
95.8 KB
Loading

0 commit comments

Comments
 (0)