Skip to main content
The Search API enables powerful querying of evidence items using Lucene’s query syntax with IPED-specific enhancements.

IPEDSearcher Class

Package: iped.engine.search
Source: iped-engine/src/main/java/iped/engine/search/IPEDSearcher.java
The IPEDSearcher class is the primary interface for searching IPED cases.

Creating a Searcher

constructor
Creates a searcher for the specified case without a predefined query
constructor
Creates a searcher with a query string. The query is parsed using IPED’s query syntax.
constructor
Creates a searcher with a Lucene Query object

Basic Search Example

Query Methods

void
Sets the query from a text string. Throws RuntimeException wrapping ParseException or QueryNodeException if the query syntax is invalid.
void
Sets a Lucene Query object directly
Query
Returns the current Lucene Query object

Query Configuration

void
If false (default), excludes tree nodes from results. Tree nodes are internal structural items.
void
If true, disables relevance scoring for faster performance. Automatically enabled for result sets larger than 1 million items.
void
If true (default), rewrites queries for optimization

Example: Advanced Configuration

Executing Searches

Executes the search on a single IPEDSource and returns results. Throws IOException on index access errors.
Executes the search on an IPEDMultiSource (multiple cases) and returns combined results. Throws IOException on index access errors.
void
Cancels an ongoing search operation

Multi-Case Search Example

SearchResult Interface

Package: iped.search

Result Methods

int
Returns the number of items in the search result
int[]
Returns an array of item IDs in the result set
IItemId
Returns the IItemId at the specified index in the result list
Iterator<IItemId>
Returns an iterator over the result set

Example: Processing Results

Query Syntax

IPED uses Lucene query syntax with field-specific searches.

Basic Syntax

Field Names

Common indexed fields:
String
Filename
String
Full file path
String
Detected file type extension
String
Original file extension
String
Item category (images, videos, documents, etc.)
String
Extracted text content (default field if no field specified)
Long
File size in bytes
String
Hash value (MD5, SHA-1, SHA-256, etc.)
Boolean
Whether file is deleted
Boolean
Whether file was recovered by carving

Query Examples

Range Queries

Wildcards and Regex

Boosting

Advanced Search Patterns

Finding Suspicious Files

Filtering by Multiple Criteria

Excluding Items

Performance Optimization

Large Result Sets

When search returns more than 1 million items (MAX_SIZE_TO_SCORE = 1000000), scoring is automatically disabled to improve performance.

Sorted Results

Use constructor with sort parameters:

Caching Searches

QueryBuilder Class

Package: iped.engine.search
Source: iped-engine/src/main/java/iped/engine/search/QueryBuilder.java
The QueryBuilder class provides programmatic query construction.

Creating Queries

constructor
Creates a query builder for the specified case
Query
Parses a query string and returns a Lucene Query object

Programmatic Query Building

Escaping Special Characters

Error Handling

Best Practices

Use Specific Fields: Query specific fields (e.g., name:report.pdf) instead of full-text searches when possible for better performance.
Disable Scoring: Use setNoScoring(true) when you only need to filter items and don’t need relevance ranking.
Wildcard Performance: Leading wildcards (e.g., *word) are expensive. Avoid them when possible or use them with other constraints.
Escape User Input: Always escape special characters in user-provided query strings using QueryBuilder.escape().

See Also