SemanticSearchImplementation
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SemanticSearchImplementation.RdfSearchMapper Class Reference

Contains the main logic to use a document-based search engine for RDF-based metadata records. More...

Public Member Functions

 RdfSearchMapper (IRdfConnector connector, ISearchClient searchClient, string language)
 Creates an instance of the class RdfSearchMapper. More...
 
async Task SearchAsync (string query, string user, bool advanced=SEARCH_ADVANCED, int size=SEARCH_SIZE, int from=SEARCH_FROM, string sorting=SEARCH_SORTING)
 Executes a search query. More...
 
async Task AddDocumentAsync (string graphName)
 Adds or updates a single document. More...
 
async Task DeleteDocumentAsync (string graphName)
 Deletes a single document. More...
 
async Task CreateIndexAsync ()
 Creates a first index with indexes all existing metadata graphs. More...
 
async Task ReIndexAsync ()
 Creates a new index (and mapping) and reindexes all existing metadata graphs. More...
 

Private Member Functions

IDictionary< string, JObject > CreateDocument (string graphName, bool changeOtherDocs)
 Creates the mapping of a metadata graph. More...
 
string GetCurrentIndex ()
 

Private Attributes

readonly ISearchClient _searchClient
 
readonly RdfClient _RdfClient
 
ElasticsearchIndexMapper _indexMapper
 
int _version
 

Static Private Attributes

const int SEARCH_SIZE = 50
 
const int SEARCH_FROM = 0
 
const bool SEARCH_ADVANCED = false
 
const string SEARCH_SORTING = "['_score']"
 

Detailed Description

Contains the main logic to use a document-based search engine for RDF-based metadata records.

Constructor & Destructor Documentation

◆ RdfSearchMapper()

SemanticSearchImplementation.RdfSearchMapper.RdfSearchMapper ( IRdfConnector  connector,
ISearchClient  searchClient,
string  language 
)
inline

Creates an instance of the class RdfSearchMapper.

Parameters
connectorInstance of an IRdfConnector.
searchClientInstance of an ISearchClient.
languageAbbreviated string representation of the language used.

Member Function Documentation

◆ AddDocumentAsync()

async Task SemanticSearchImplementation.RdfSearchMapper.AddDocumentAsync ( string  graphName)
inline

Adds or updates a single document.

Parameters
graphNameID of metadata graph.
Returns
A task that represents the asynchronous save operation.

◆ CreateDocument()

IDictionary<string, JObject> SemanticSearchImplementation.RdfSearchMapper.CreateDocument ( string  graphName,
bool  changeOtherDocs 
)
inlineprivate

Creates the mapping of a metadata graph.

Additional rules can influence the mapping of existing metadata graphs.

Parameters
graphNameID of the metadata graph.
changeOtherDocsA dictionary containing the ID of metadata graphs (key) and corresponding JSON objects (value).
Returns

◆ CreateIndexAsync()

async Task SemanticSearchImplementation.RdfSearchMapper.CreateIndexAsync ( )
inline

Creates a first index with indexes all existing metadata graphs.

Returns
A task that represents the asynchronous create operation.

◆ DeleteDocumentAsync()

async Task SemanticSearchImplementation.RdfSearchMapper.DeleteDocumentAsync ( string  graphName)
inline

Deletes a single document.

Parameters
graphNameID of metadata graph.
Returns
A task that represents the asynchronous delete operation.

◆ GetCurrentIndex()

string SemanticSearchImplementation.RdfSearchMapper.GetCurrentIndex ( )
inlineprivate

◆ ReIndexAsync()

async Task SemanticSearchImplementation.RdfSearchMapper.ReIndexAsync ( )
inline

Creates a new index (and mapping) and reindexes all existing metadata graphs.

This operation is necessary if an application profile changes or a new is added.

Returns
A task that represents the asynchronous create operation.

◆ SearchAsync()

async Task SemanticSearchImplementation.RdfSearchMapper.SearchAsync ( string  query,
string  user,
bool  advanced = SEARCH_ADVANCED,
int  size = SEARCH_SIZE,
int  from = SEARCH_FROM,
string  sorting = SEARCH_SORTING 
)
inline

Executes a search query.

Parameters
queryThe search query of the user.
userThe user who searches.
advancedlag to specify simple or advanced search syntax.
sizeNumber of results.
fromPosition from which the results should be returned.
sortingSorting of the results (see https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html).
Returns
A task that represents the asynchronous search operation.

Member Data Documentation

◆ _indexMapper

ElasticsearchIndexMapper SemanticSearchImplementation.RdfSearchMapper._indexMapper
private

◆ _RdfClient

readonly RdfClient SemanticSearchImplementation.RdfSearchMapper._RdfClient
private

◆ _searchClient

readonly ISearchClient SemanticSearchImplementation.RdfSearchMapper._searchClient
private

◆ _version

int SemanticSearchImplementation.RdfSearchMapper._version
private

◆ SEARCH_ADVANCED

const bool SemanticSearchImplementation.RdfSearchMapper.SEARCH_ADVANCED = false
staticprivate

◆ SEARCH_FROM

const int SemanticSearchImplementation.RdfSearchMapper.SEARCH_FROM = 0
staticprivate

◆ SEARCH_SIZE

const int SemanticSearchImplementation.RdfSearchMapper.SEARCH_SIZE = 50
staticprivate

◆ SEARCH_SORTING

const string SemanticSearchImplementation.RdfSearchMapper.SEARCH_SORTING = "['_score']"
staticprivate

The documentation for this class was generated from the following file: