Constructor
new SearchService(options)
Creates a new SearchService
.Creates a new SearchService
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Configuration options Properties
|
- 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>
(async) search(queryText, limit) → {Promise.<Array>}
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