Table of Contents

Method Suggest

Namespace
Skyline.DataMiner.Net.Jobs
Assembly
SLNetTypes.dll

Suggest(string, int)

Retrieves suggestions for the specified query limited to the specified limit.

public List<JobSuggestion> Suggest(string query, int amount)

Parameters

query string

The query string provided by the user that will be used to search the jobs.

amount int

The suggestion limit.

Returns

List<JobSuggestion>

The suggested items.

Examples

JobManagerHelper jobManagerHelper = new JobManagerHelper(msg => protocol.SLNet.RawConnection.HandleMessages(msg));

var suggestions = jobManagerHelper.Jobs.Suggest("MyJobName", 5);

foreach (var suggestion in suggestions)
{
	var fieldDescriptorId = suggestion.MatchedField; // This will be the DefaultJobSectionDefinition.NameFieldDescriptorID descriptor ID.
	var fieldValue = suggestion.MatchedValue;
	// ...
}

Exceptions

DataMinerException

An unexpected error occurred while retrieving suggestions.

Suggest(string, int, List<FieldDescriptorID>, FilterElement<Job>)

Retrieves suggestions for the specified query limited to the specified limit.

public List<JobSuggestion> Suggest(string query, int amount, List<FieldDescriptorID> fieldIds, FilterElement<Job> filter)

Parameters

query string

The query string provided by the user that will be used to search the jobs.

amount int

The suggestion limit.

fieldIds List<FieldDescriptorID>

The IDs of the fields on which suggestions should be searched. Defaults to only the Name field of the job.

filter FilterElement<Job>

The filter defining restrictions that a job should comply with to be included in the suggestions. Usually used to specify start/end time restrictions for the jobs.

Returns

List<JobSuggestion>

The suggested items.

Remarks

  • Each returned suggestion has the field that matched, the value that matched and the score. (The score indicates the quality of the match.)
  • The query must be at least 3 characters long.
  • Only fields of type "string" will be used to test the query against.
  • This method obtains suggestions based on string fields of the job.
JobManagerHelper jobManagerHelper = new JobManagerHelper(msg => protocol.SLNet.RawConnection.HandleMessages(msg));

var suggestions = jobManagerHelper.Jobs.Suggest("myQuery", 2, new List<FieldDescriptorID>() { fieldDescriptor.ID }, JobExposers.FieldValues.JobField(DefaultJobSectionDefinition.NameFieldDescriptorID).Contains("MyNameFilter"));

foreach (var suggestion in suggestions) { var fieldDescriptorId = suggestion.MatchedField; // This will be the field descriptor ID of the matching field. var fieldValue = suggestion.MatchedValue; // ... }

Exceptions

DataMinerException

An unexpected error occurred while retrieving suggestions.