ISearchSourceDataResult.DateLevels

Syntax

DateLevels: Array;

Description

The DateLevels property returns the list of calendar levels, for which the source has data.

Comments

Each array element contains numeric value determining level. To check values, you can use the DimCalendarLevel enumeration.

Example

It is supposed that the repository is set up to work with search service based on Apache Solr. Search service base has indexed data about various repository data source slices. Add links to the BISearch, Fore, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
    SearchExecutor: ISearchExecutor;
    SearchContext: ISolrSourceDataSearchContext;
    Results: ISolrSearchResults;
    Result: ISearchSourceDataResult;
    i: Integer;
    s: String;
Begin
    MB := MetabaseClass.Active;
    //Search and indexing parameters specified for repository
    SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Search parameters
    SearchExecutor := Schema.SearchExecutor(SearchEngineTargetType.SourceData);
    SearchContext := SearchExecutor.CreateContext As ISolrSourceDataSearchContext;
    SearchContext.Locale := LocaleCodeID.Russian;
    SearchContext.Text := "2000";
    //Search
    Results := SearchExecutor.Search(SearchContext) As ISolrSearchResults;
    //View source information for the first search result
    Result := Results.Item(0As ISearchSourceDataResult;
    Debug.WriteLine("Slice name: " + Result.Name);
    Debug.WriteLine("Calendar levels for which there is a data:");
    Debug.Indent;
    For Each i In Result.DateLevels Do
        Select Case i
            Case 1: Debug.WriteLine("Years");
            Case 2: Debug.WriteLine("Half-years");
            Case 3: Debug.WriteLine("Quarters");
            Case 4: Debug.WriteLine("Months");
            Case 5: Debug.WriteLine("Days");
            Case 6: Debug.WriteLine("9 months");
            Case 7: Debug.WriteLine("Weeks");
        End Select;
    End For;
    Debug.Unindent;
    Debug.WriteLine("List of years with data:");
    For Each s In Result.Time Do
        Debug.Write(s + ' ');
    End For;
    Debug.WriteLine("");
    If Result.HighlightedTime.Length > 0 Then
        Debug.WriteLine("List of years with highlighted search value:");
        For Each s In Result.HighlightedTime Do
            Debug.Write(s + ' ');
        End For;
        Debug.WriteLine("");
    End If;
    If Result.HighlightedFreeDimensions.Length > 0 Then
        Debug.WriteLine("List of free dimensions with highlighted search dimension:");
        For Each s In Result.HighlightedFreeDimensions Do
            Debug.Write(s + ' ');
        End For;
        Debug.WriteLine("");
    End If;
End Sub UserProc;

After executing the example the specified value by indexed information about dimension elements will be searched. The first found result will provide information about the calendar period, for which there is a data. This information will be displayed in the development environment console. The information about free dimensions will be also displayed, if available.

See also:

ISearchSourceDataResult