Advanced Search
Open Register provides powerful search capabilities that allow filtering objects based on their properties using a flexible query syntax.
Automatic Facets
OpenRegister provides a comprehensive faceting system that enables dynamic filtering based on object properties and metadata. The system supports multiple facet types and automatic field discovery.
For detailed information about faceting capabilities, see the Comprehensive Faceting Documentation.
Key Faceting Features
- Facet Types: Terms, date histograms, and numeric ranges
- Automatic Discovery: Use
_facetable=trueto discover available facetable fields - Schema-Based: Facets configured via schema properties marked with
facetable: true - UUID Resolution: Automatic conversion of UUIDs to human-readable names
- Disjunctive Faceting: Facet options remain visible even when selected
- Two-Stage System: Discovery (
_facetable=true) and data retrieval (_facets[...])
Quick Example
# Discover available facets
GET /api/objects/5/24?_facetable=true&_limit=0
# Get facet data
GET /api/objects/5/24?_facets[@self][register][type]=terms&_facets[status][type]=terms
Content Search
Content Search provides powerful search capabilities across objects and their associated files through text extraction and indexing.
📚 For complete pipeline documentation: See Text Extraction, Vectorization & Named Entity Recognition which covers all three services in detail.
For detailed information about text extraction sources, see the Text Extraction Sources Documentation.
Text Extraction Overview
OpenRegister processes content from two distinct sources:
- Files: Documents (PDF, DOCX), images (OCR), spreadsheets, and text files
- Objects: Structured data entities with property values extracted as text
Processing Pipeline
Both sources go through:
- Text Extraction: Files via LLPhant/Dolphin, objects via property concatenation
- Chunking: Smart text splitting (recursive or fixed-size strategies)
- Solr Indexing: Full-text search indexing
- Optional Enhancements: Vector embeddings, entity extraction, language detection
Supported File Types
- Documents: PDF, DOCX, DOC, ODT, RTF
- Spreadsheets: XLSX, XLS, CSV
- Presentations: PPTX
- Text Files: TXT, MD, HTML, JSON, XML
- Images: JPG, PNG, GIF, WebP, TIFF (via OCR)
Search Integration
Extracted text is indexed in Solr, enabling:
- Full-text search across file content and object properties
- Combined search results from files and objects
- Faceted search by file type, metadata, and object properties
Solr Integration
OpenRegister uses Apache Solr as its search engine, providing advanced search and analytics capabilities for objects and their content.
Overview
The search system enables:
- Full-text search
- Metadata search
- File content search
- Advanced query options
- Saved Views - Save and reuse complex search configurations
Key Benefits
-
Discovery
- Find relevant content
- Explore relationships
- Discover patterns
-
Integration
- Combined search results
- Unified interface
- Rich filtering
-
Performance
- Optimized indexing
- Fast results
- Scalable search
Overview
The search system enables you to filter objects using query parameters. However, it's important to note that this approach is limited by the maximum URL length supported by browsers and servers (typically 2,048 characters for most browsers).
For more complex queries that exceed URL length limitations, we are planning to implement GraphQL support in the future. This would enable:
- Deeply nested queries
- Complex filtering logic
- Precise field selection
- Batch operations
- Real-time subscriptions
Note: GraphQL implementation is currently pending funding. If you're interested in supporting this feature, please contact us.
In the meantime, here are the available search capabilities using URL parameters:
Open Catalogi Integration
If you have Open Catalogi installed alongside OpenRegister, you gain access to the more flexible /api/publications endpoint. This endpoint provides enhanced filtering capabilities that allow you to search across multiple registers and schemas without being constrained by URL path parameters.
Publications Endpoint Advantages
The publications endpoint (/api/publications) offers several advantages over register/schema-specific endpoints:
- Cross-register searching: Filter objects from multiple registers simultaneously
- Dynamic schema filtering: Switch between schemas without changing the endpoint
- Cleaner URLs: No need to include register/schema in the URL path
- More flexible queries: Better support for complex filter combinations
Register and Schema Filtering in Publications
When using the publications endpoint, register and schema become regular query parameters instead of URL path components:
Basic Publications Filtering
# Search across all registers and schemas
GET /api/publications
# Filter by specific register
GET /api/publications?register=5
# Filter by specific schema
GET /api/publications?schema=24
# Filter by both register and schema
GET /api/publications?register=5&schema=24
Multiple Register/Schema Filtering
# Objects from multiple registers
GET /api/publications?register[]=5®ister[]=6®ister[]=7
# Objects from multiple schemas
GET /api/publications?schema[]=24&schema[]=25
# Complex combinations
GET /api/publications?register[]=5®ister[]=6&schema[]=24&schema[]=25
Combined with Metadata Filters
# Date filtering across multiple registers
GET /api/publications?register[]=5®ister[]=6&@self[created][gte]=2025-06-25T00:00:00
# Schema filtering with content search
GET /api/publications?schema=24&@self[title][~]=budget&_search=annual
# Complex multi-criteria search
GET /api/publications?register=5&schema[]=24&schema[]=25&@self[published][exists]=true&@self[created][gte]=2025-01-01T00:00:00
Comparison: OpenRegister vs Publications Endpoints
| Feature | OpenRegister Endpoint | Publications Endpoint |
|---|---|---|
| URL Format | /api/objects/5/24?filters | /api/publications?register=5&schema=24&filters |
| Cross-register | ❌ Not supported | ✅ Supported |
| Multiple schemas | ❌ Single schema only | ✅ Multiple schemas |
| URL complexity | Higher (path parameters) | Lower (query parameters) |
| Filter flexibility | Limited by path structure | Full query parameter flexibility |
Migration Example
Convert existing OpenRegister queries to use the publications endpoint:
# OpenRegister format
GET /api/objects/5/24?@self[created][gte]=2025-06-25T00:00:00&@self[title][~]=budget
# Equivalent Publications format
GET /api/publications?register=5&schema=24&@self[created][gte]=2025-06-25T00:00:00&@self[title][~]=budget
# Enhanced Publications format (multiple schemas)
GET /api/publications?register=5&schema[]=24&schema[]=25&@self[created][gte]=2025-06-25T00:00:00&@self[title][~]=budget
When to Use Each Endpoint
Use OpenRegister endpoints (/api/objects/{register}/{schema}) when:
- Working with a single, specific register and schema
- Building register-specific applications
- Need guaranteed register/schema validation in URL routing
Use Publications endpoint (/api/publications) when:
- Searching across multiple registers or schemas
- Building general-purpose search interfaces
- Need maximum query flexibility
- Want cleaner, more maintainable URLs
The publications endpoint requires Open Catalogi to be installed and configured alongside OpenRegister. If you don't see the /api/publications endpoint, check your Open Catalogi installation.
Metadata Filtering
OpenRegister supports comprehensive filtering on object metadata using query parameters. All metadata fields can be filtered using the '@self' prefix followed by the field name and optional operator.
Core Metadata Fields
The following metadata fields are available for filtering on all objects:
System Fields
| Field | Description | Type | Example |
|---|---|---|---|
id | Object unique identifier | UUID | @self[id]=550e8400-e29b-41d4-a716-446655440000 |
uuid | Object universal unique ID | UUID | @self[uuid]=550e8400-e29b-41d4-a716-446655440000 |
register | Register ID or slug | Integer/String | @self[register]=5 or @self[register]=pets |
schema | Schema ID or slug | Integer/String | @self[schema]=24 or @self[schema]=animal |
version | Object version number | String | @self[version]=1.0.0 |
size | Object size in bytes | String | @self[size][gte]=1024 |
schemaVersion | Schema version used | String | @self[schemaVersion]=2.1.0 |
Timestamps
| Field | Description | Type | Example |
|---|---|---|---|
created | Creation timestamp | DateTime | @self[created][gte]=2025-06-25T00:00:00 |
updated | Last write, by anyone or anything | DateTime | @self[updated][lt]=2025-06-30T23:59:59 |
lastUserActivity | Last write by a person (empty until a person writes) | DateTime | @self[lastUserActivity][lt]=2025-06-30T23:59:59 |
published | Publication timestamp | DateTime | @self[published][gte]=2025-01-01T00:00:00 |
depublished | Depublication timestamp | DateTime | @self[depublished][lte]=2025-12-31T23:59:59 |
updated moves on every write, including background jobs, listeners and
other system writes that recompute a field. lastUserActivity moves only when a
signed-in user writes the object in a web request. Use it to find objects nobody
has worked on, for example cases that stalled:
GET /api/objects/5/24?@self[lastUserActivity][lt]=2026-10-01T00:00:00&_order[@self.lastUserActivity]=asc
These writes leave lastUserActivity as it was:
- anything on the command line: occ commands, CLI cron and repair steps;
- Nextcloud's web or AJAX cron (
cron.php), including jobs that act as a user; - a write without a signed-in user;
- a write inside
SystemOperationContext; - a write labelled with a
WriteCauseother thanperson(scheduled,rule,import,migration,cascade). A listener that recomputes fields during a user's request can wrap its save inWriteCause::runAs(cause: WriteCause::RULE, run: null, operation: fn () => ...)to stay out of it.
Bulk saves (saveObjects, imports) do not set it either. Objects that existed
before the field was added have no value until a person writes them.
Content Fields
| Field | Description | Type | Example |
|---|---|---|---|
name | Object name | String | @self[name][~]=Annual Report |
description | Object description | String | @self[description][$]=implementation |
uri | Object URI | String | @self[uri][^]=https://api.example.com |
folder | Object folder path | String | @self[folder][~]=documents |
Ownership & Access
| Field | Description | Type | Example |
|---|---|---|---|
organization | Owning organization ID | UUID | @self[organization]=550e8400-e29b-41d4-a716-446655440000 |
application | Source application ID | UUID | @self[application]=550e8400-e29b-41d4-a716-446655440000 |
owner | Object owner | String | @self[owner]=john.doe |
license | Object license | String | @self[license]=CC-BY-4.0 |
source | Data source identifier | String | @self[source]=external-api |
Status & State
| Field | Description | Type | Example |
|---|---|---|---|
hash | Object content hash | String | @self[hash]=a1b2c3d4e5f6 |
uri | Object URI | String | @self[uri][~]=api.example.com |
Filtering Operators
All metadata fields support the following operators for precise filtering:
| Operator | Description | Example |
|---|---|---|
= | Equals (case insensitive) | @self[name]=annual report |
ne | Not equals (case insensitive) | @self[status][ne]=draft |
gt | Greater than | @self[version][gt]=1 |
lt | Less than | @self[version][lt]=5 |
gte | Greater than or equal | @self[created][gte]=2025-01-01T00:00:00 |
lte | Less than or equal | @self[updated][lte]=2025-12-31T23:59:59 |
like | Contains (case insensitive) | @self[name][like]=budget |
~ | Contains (case insensitive) | @self[description][~]=budget |
^ | Starts with (case insensitive) | @self[name][^]=annual |
$ | Ends with (case insensitive) | @self[name][$]=2025 |
=== | Equals (case sensitive) | @self[name][===]=Annual Report |
exists | Property exists check | @self[published][exists]=true |
empty | Empty value check | @self[summary][empty]=true |
null | Null value check | @self[depublished][null]=true |
isnull | Empty (true) or filled (false) | @self[expires][isnull]=true |
orNull | Also match rows where the field is empty (a modifier, see below) | @self[expires][lt]=2026-01-01&@self[expires][orNull]=true |
inOrEmpty | One of the values, or no value at all (null, missing, '' or []) | setting_inOrEmpty[]=<uuid> |
Including empty values with orNull
Every comparison leaves out rows where the field is empty, because SQL treats a
comparison with NULL as unknown. So isFinalStatus[ne]=true does not return a
case whose isFinalStatus was never written, and neither does
isFinalStatus=false.
Add orNull=true to the same field to get those rows as well. The other
operators on that field still apply together, and the field also matches when it
is empty:
GET /api/objects/5/24?isFinalStatus[ne]=true&isFinalStatus[orNull]=true
GET /api/objects/5/24?isFinalStatus_ne=true&isFinalStatus_orNull=true
From PHP, through ObjectService::searchObjects():
['isFinalStatus' => ['ne' => true, 'orNull' => true]]
['isFinalStatus' => ['in' => [false], 'orNull' => true]]
['@self' => ['expires' => ['lt' => '2026-01-01', 'orNull' => true]]]
orNull works on schema properties, on @self metadata fields and on paths
inside object properties (dwell.breached[ne]=true&dwell.breached[orNull]=true).
It reads its value like isnull: true, 1, on and yes switch it on,
anything else leaves the filter as it was. On its own, without another operator,
it adds no condition. ne and the other operators keep their meaning when
orNull is absent.
A value or no value with inOrEmpty
inOrEmpty matches objects whose property is one of the listed values, or
has no value: null, missing, an empty string or an empty array. It is the
filter for "this world plus the shared things that belong to no world", in one
query, so paging, totals and facets are computed on the same condition:
GET /api/objects/larpinq/character?setting_inOrEmpty[]=<world uuid>
GET /api/objects/larpinq/character?setting[inOrEmpty][]=<world uuid>
- It works on scalar properties (
IN), on array properties (the item is one of the values), on@selfmetadata fields (@self[organisation][inOrEmpty][]=…) and on paths inside object properties. - Other operators on the same property still apply together with it.
- An empty list (
setting_inOrEmpty[]=) matches only the rows with no value: that is its literal meaning.
orNull admits only null; inOrEmpty also admits '' and [].
We use operator names like gte, lte, gt, lt, and ne instead of mathematical symbols like >=, <=, >, <, and != to avoid URL encoding problems.
The Problem: When using mathematical symbols in URL parameters, they get URL encoded:
age[>=]=5becomesage[%3E=]=5weight[<=]=10becomesweight[%3C=]=10
This URL encoding can cause parsing issues with PHP's $_GET parameter processing, especially when operators are used within array key brackets.
The Solution: Using descriptive operator names ensures clean, readable URLs:
age[gte]=5(greater than or equal)weight[lte]=10(less than or equal)name[ne]=test(not equal)
This approach maintains compatibility across different web servers and ensures reliable parameter parsing.
Metadata Filtering Examples
Basic Metadata Filtering
# Filter by register
GET /api/objects/5/24?@self[register]=5
# Filter by creation date
GET /api/objects/5/24?@self[created][gte]=2025-06-01T00:00:00
# Filter by name containing specific text
GET /api/objects/5/24?@self[name][~]=budget
# Filter by published objects
GET /api/objects/5/24?@self[published][exists]=true
Advanced Metadata Combinations
# Objects created after date AND belonging to specific organization
GET /api/objects/5/24?@self[created][gte]=2025-01-01T00:00:00&@self[organization]=550e8400-e29b-41d4-a716-446655440000
# Published objects with specific name pattern
GET /api/objects/5/24?@self[published][exists]=true&@self[name][^]=Annual
# Objects updated within date range
GET /api/objects/5/24?@self[updated][gte]=2025-06-01T00:00:00&@self[updated][lte]=2025-06-30T23:59:59
# Exclude draft objects
GET /api/objects/5/24?@self[status][ne]=draft
Register and Schema Filtering
# Objects from multiple registers (when using general search endpoints)
GET /api/search?@self[register][]=5&@self[register][]=6
# Objects with specific schema
GET /api/search?@self[schema]=24
# Combined register, schema, and date filter
GET /api/search?@self[register]=5&@self[schema]=24&@self[created][gte]=2025-06-25T00:00:00
Date Format Handling
When working with date fields like created, updated, published, and depublished, it's important to understand the date format requirements.
Standard Date Format
Open Register uses ISO 8601 date format without timezone suffixes for optimal database compatibility:
Correct Format: 2025-06-23T14:30:00
Avoid: 2025-06-23T14:30:00.000Z or 2025-06-23T14:30:00+00:00
Date Range Examples
# Objects created after June 21, 2025 at 22:00
GET /api/objects?@self[created][gte]=2025-06-21T22:00:00
# Objects updated before June 25, 2025
GET /api/objects?@self[updated][lt]=2025-06-25T00:00:00
# Objects published within a specific date range
GET /api/objects?@self[published][gte]=2025-06-01T00:00:00&@self[published][lte]=2025-06-30T23:59:59
Frontend Implementation
When implementing date filters in JavaScript/frontend code, ensure you convert dates to the correct format:
// Convert Date object to OpenRegister format
const formatDateForOpenRegister = (date) => {
if (!date) return null
// Remove timezone info to match database format
return new Date(date).toISOString().replace(/\.000Z$/, '')
}
// Example usage
const fromDate = formatDateForOpenRegister(new Date('2025-06-21'))
// Result: '2025-06-21T00:00:00'
This standardized format ensures consistent date comparisons across different timezones and database configurations.
Search User Interface
OpenRegister provides an optimized search interface with explicit search actions and multiple search term support.
Explicit Search Action
Search operations require explicit user action rather than automatic triggering:
Features:
- User-Controlled: Search executes only when user clicks Search button or presses Enter
- Loading Indicators: Visual feedback during search execution
- Performance Statistics: Real-time display of search execution time and result counts
- No Automatic Triggers: Eliminates excessive API calls from typing
Benefits:
- Reduced Server Load: Fewer unnecessary API calls (1 call vs 4+ for typing 'test')
- Better Performance: Only executes when user intends to search
- User Feedback: Clear indication of search progress and results
Multiple Search Terms Support
The search interface supports multiple search terms:
Features:
- Comma or Space Separated: Enter multiple terms separated by commas or spaces
- Visual Term Chips: Each search term displayed as a removable chip
- Individual Term Removal: Remove specific terms without re-entering others
- Combined Search: All terms searched together across object fields
Example:
Search: "budget, annual, 2025"
Results: Objects containing all three terms
Search Performance Monitoring
The system provides real-time performance feedback:
Statistics Displayed:
- Total results found
- Search execution time in milliseconds
- Search term count
Performance Benefits:
- Transparency for users
- Debugging information for developers
- Performance trend tracking
Full Text Search
The '_search' parameter allows searching across all text properties of objects in a case-insensitive way:
GET /api/pets?_search=nemo
This searches for "nemo" in all text fields like name, description, notes etc.
Multiple Search Terms:
GET /api/pets?_search=budget annual 2025
Searches for objects containing all specified terms.
Cross-Table Search (Magic Mapper)
When using Magic Mapper (objects stored in dedicated tables), you can search across multiple schemas and registers simultaneously:
Single Schema Search:
# Default behavior - single schema
GET /api/objects/3/1?_search=test
Multiple Schemas - Comma-Separated:
# Search across schema 1 and 2 in register 3
GET /api/objects/3/1?_search=test&schemas=1,2
Multiple Schemas - Array Format:
# Same result using array notation
GET /api/objects/3/1?_search=test&schemas[]=1&schemas[]=2
Cross-Register and Cross-Schema:
# Search across multiple registers and schemas
GET /api/objects/3/1?_search=test®isters=1,2&schemas=1,2
Response Format:
{
'results': [...],
'total': 42,
'pages': 3,
'@self': {
'source': 'cross_table_magic_mapper',
'table_count': 4,
'register_count': 2,
'schema_count': 2
}
}
Cross-Table Search Features
- Global Relevance Scoring: Results from all tables are sorted by search relevance
- Automatic Deduplication: Duplicate schema/register IDs are filtered out
- Graceful Error Handling: If one table fails, search continues with remaining tables
- Schema Context: Each result includes its source register and schema
- Performance: Scales linearly - ~275ms for single table + ~2ms per additional table
Hybrid Storage Search
OpenRegister supports searching across both storage strategies simultaneously:
Storage Types:
- Blob Storage: Traditional storage (all objects in 'oc_openregister_objects' table)
- Magic Mapper: Dynamic tables (each register+schema combination has its own table)
How It Works:
- Objects are automatically routed to the correct storage based on register configuration
- Search queries transparently work across both storage types
- Results are merged and sorted by relevance
- No client-side changes needed - the API handles storage routing automatically
Example Scenario:
# Register 3 uses Magic Mapper, Register 4 uses Blob Storage
GET /api/objects/3/1?_search=budget®isters=3,4
# Results include objects from both storage types, sorted by relevance
{
'results': [
{'@self': {'register': '3', 'schema': '1', ...}}, # From magic table
{'@self': {'register': '4', 'schema': '2', ...}} # From blob storage
],
'total': 2
}
Wildcard Search
You can use wildcards in the search term:
*matches zero or more characters
GET /api/pets?_search=ne*o
Matches "nemo", "negro", "neuro" etc.
?matches exactly one character
GET /api/pets?_search=ne?o
Matches "nemo", "nero" but not "neuro"
Pattern Matching
^matches start of text
GET /api/pets?_search=^ne
Matches text starting with "ne"
$matches end of text
GET /api/pets?_search=mo$
Matches text ending with "mo"
Phrase Search
Use quotes for exact phrase matching:
GET /api/pets?_search="orange fish"
Matches the exact phrase "orange fish"
Basic Search
Simple equals search (case insensitive):
GET /api/pets?name=nemo
This returns all pets named "nemo", "Nemo", "NEMO", etc.
Case sensitive search:
GET /api/pets?name[===]=Nemo
This returns only pets named exactly "Nemo".
Comparison Operators
Not Equals ne
GET /api/pets?name[ne]=nemo
Returns all pets NOT named "nemo" (case insensitive)
Greater Than gt
GET /api/pets?age[gt]=5
Returns pets older than 5 years
Less Than lt
GET /api/pets?weight[lt]=10
Returns pets weighing less than 10kg
Greater Than or Equal gte
GET /api/pets?age[gte]=2
Returns pets 2 years or older
Less Than or Equal lte
GET /api/pets?age[lte]=10
Returns pets 10 years or younger
Contains like
GET /api/pets?name[like]=ne
GET /api/pets?name_like=ne
Returns pets with "ne" anywhere in their name ("nemo", "Nero", "ANNE"), ignoring case. Both spellings mean the same filter.
%,_and\in the value match themselves.name[like]=50%finds "50% off" and not "500".- Several values match any of them:
name[like][]=nemo&name[like][]=dory. - An empty value adds no condition, so a cleared filter shows everything.
- The column is compared as text, so
likealso works on numbers, dates and JSON columns. On a JSON column it matches the stored JSON text. - It works on
@selfmetadata too:@self[name][like]=report.
The value is always sent to the database as a bound parameter (or quoted by the database driver on the multi-schema search path), never pasted into the SQL.
like is the contains filter the object search reads. The ~, ^ and $ operators below belonged to the retired object-table search and the current search does not read them.
Contains ~
GET /api/pets?name[~]=ne
Returns pets with "ne" in their name (like "nemo", "nero", "Nemo", etc) - case insensitive
Starts With ^
GET /api/pets?name[^]=ne
Returns pets whose names start with "ne" (case insensitive)
Ends With $
GET /api/pets?name[$]=mo
Returns pets whose names end with "mo" (case insensitive)
Combining Multiple Conditions
AND Operations
GET /api/pets?name=nemo&type=fish
Returns pets named "nemo" (case insensitive) AND of type "fish"
OR Operations
GET /api/pets?name[]=nemo&name[]=dory
Returns pets named either "nemo" OR "dory" (case insensitive)
Special Filters
Exists Check
GET /api/pets?microchip[exists]=true
Returns pets that have a microchip property
Empty Check
GET /api/pets?notes[empty]=true
Returns pets with empty notes
Null Check
GET /api/pets?owner[null]=true
Returns pets with no owner
Between Range
GET /api/pets?age[gte]=2&age[lte]=5
Returns pets between 2 and 5 years old (inclusive)
GET /api/pets?age[gt]=2&age[lt]=5
Returns pets between 2 and 5 years old (exclusive)
Searching Nested Properties
GET /api/pets?owner.city=Amsterdam
Returns pets whose owners live in Amsterdam (case insensitive)
GET /api/pets?vaccinations.date[gt]=2023-01-01
Returns pets with vaccinations after January 1st, 2023
Best Practices
- Use URL encoding for special characters
- Keep queries focused and specific
- Use pagination for large result sets
- Consider URL length limitations
- Break complex queries into multiple requests if needed
Performance Considerations
Indexing
- Core metadata fields (
id,uuid,created,updated,register,schema) are automatically indexed - Date fields support efficient range queries
- String fields with operators like
~,^,$may be slower on large datasets
Query Optimization
# Efficient: Use indexed fields first
GET /api/objects/5/24?@self[created][gte]=2025-01-01&@self[title][~]=budget
# Less efficient: Complex string operations on large datasets
GET /api/objects/5/24?@self[description][~]=very_specific_text
Pagination with Metadata Filters
# Always use pagination with filters
GET /api/objects/5/24?@self[created][gte]=2025-01-01&_limit=50&_offset=0
Search Engine Implementation
Solr Integration
OpenRegister uses Apache Solr as its search engine, providing powerful full-text search and faceting capabilities.
Case-Insensitive Search
All text searches are case-insensitive by default. The search implementation uses 'mb_strtolower()' to normalize search terms before querying Solr:
// Search terms are normalized to lowercase
$cleanTerm = mb_strtolower($cleanTerm);
This ensures that searches work consistently regardless of input case:
- 'software' = 'SOFTWARE' = 'SoFtWaRe' (all return the same results)
- Handles international characters correctly (é, ñ, ü, etc.)
- Works with UTF-8 encoded strings
The normalization happens before the query is sent to Solr, ensuring reliable search behavior across different Solr configurations.
Ordering and Sorting
Objects can be ordered by metadata fields using the '_order' parameter:
Sortable Fields:
- '@self.name' - Alphabetical by object name (uses 'self_name_s' Solr field)
- '@self.published' - Chronological by published date
- '@self.created' - Chronological by creation date
- '@self.updated' - Chronological by update date
Sorting Directions:
- 'asc' - Ascending order (A→Z, oldest→newest)
- 'desc' - Descending order (Z→A, newest→oldest)
Examples:
# Alphabetical order (A→Z)
GET /api/objects?_source=index&_order[@self.name]=asc
# Reverse alphabetical (Z→A)
GET /api/objects?_source=index&_order[@self.name]=desc
# Newest first
GET /api/objects?_source=index&_order[@self.published]=desc
# Oldest first
GET /api/objects?_source=index&_order[@self.created]=asc
Technical Implementation:
- Text fields use sortable string variants (with '_s' suffix)
- Solr schema includes sortable copies of searchable fields
- Date fields use native Solr date sorting
- Field mapping handled by 'translateSortableField()' method
Search Performance
Weighted Field Search: The search engine uses weighted field boosting to prioritize matches in certain fields:
// Example weights
'self_name^10' // Name field has highest priority
'self_title^8' // Title field is second priority
'self_description^5' // Description has medium priority
'self_summary^3' // Summary has lower priority
This ensures that matches in object names are ranked higher than matches in descriptions.
Field Types in Solr:
- 'text_general' - Analyzed text fields (tokenized, lowercased, stemmed)
- 'string' - Exact value fields (not tokenized, for sorting/faceting)
- 'date' - ISO 8601 date fields (for range queries and sorting)
- UUID fields - String fields for identifiers
Testing Search
The search implementation includes comprehensive integration tests:
Test Coverage:
- Case-insensitive search (lowercase, uppercase, mixed case)
- Ordering by name (ascending, descending)
- Ordering by dates (chronological, reverse chronological)
- Combined filters with search
- Pagination with ordering
Running Tests:
# Run all search tests
vendor/bin/phpunit tests/Integration/CoreIntegrationTest.php --filter "testCaseInsensitive|testOrdering"
# Run specific test
vendor/bin/phpunit tests/Integration/CoreIntegrationTest.php --filter testCaseInsensitiveSearchLowercase
See 'SOLR_TESTING_GUIDE.md' in the repository for detailed testing procedures.
Search Trails
Search trails provide comprehensive logging and analytics for search operations within OpenRegister. This feature allows administrators to track, analyze, and optimize search performance across all registers and schemas.
Overview
Search trails automatically capture detailed information about every search operation performed in the system, including:
- Search Terms: What users are searching for
- Performance Metrics: Execution time, result counts, and success rates
- User Context: User ID, session ID, IP address, and user agent
- Search Context: Register, schema, filters, and parameters
- Request Metadata: HTTP method, URI, and timestamps