Class: SearchService

SearchService(options)

Service for semantic search using Faiss and embeddings

Constructor

new SearchService(options)

Creates a new SearchService

.

Creates a new SearchService

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Description
embeddingService EmbeddingService

The embedding service to use

sparqlService SPARQLService

The SPARQL service to use

graphName string

The graph name to search in

dimension number

The embedding dimension

Source:

Methods

extractTitle(uri, content) → {string}

Extract a title from the content or URI

.

Extract a title from the content or URI

Parameters:
Name Type Description
uri string

The resource URI

content string

The resource content

Source:
Returns:

The extracted title

Type
string

getFilenameFromUri(uri) → {string}

Extract filename from URI

.

Extract filename from URI

Parameters:
Name Type Description
uri string

The resource URI

Source:
Returns:

The extracted filename

Type
string

(async) initialize() → {Promise.<void>}

Initialize the search service

.

Initialize the search service

Source:
Returns:
Type
Promise.<void>

(async) loadEmbeddings() → {Promise.<void>}

Load embeddings from the SPARQL store

.

Load embeddings from the SPARQL store

Source:
Returns:
Type
Promise.<void>

Search for resources similar to the query text

.

Search for resources similar to the query text

Parameters:
Name Type Default Description
queryText string

The search query text

limit number 5

Maximum number of results to return

Source:
Returns:

The search results

Type
Promise.<Array>

truncateContent(content, maxLength) → {string}

Truncate content for display

.

Truncate content for display

Parameters:
Name Type Default Description
content string

The content to truncate

maxLength number 200

Maximum length

Source:
Returns:

The truncated content

Type
string