Jump to: navigation, search

Custom Query Search


The custom query search uses a query provided via the customizing to define the context of the search.

Application

The custom query search is used when the free text search does not deliver the desired results and a customized online search based on the results of a query is desired. The custom query search does NOT include an offline search (in contrast to the free text search).

Functionality

To use the custom query search it is necessary to customize the project as it is not part of the default UI. When the custom query search is added to the customizing it can be used to replace the standard UI's free text search field or added additionally.

When using the custom query search in the customizing of a project it is necessary to provide the UID of the query object that should be used to define the search context. When no UID is given the search will never provide results. How exactly the search term is interpreted and used to return a List of results is handled on the server side.

The custom query search utilizes the same result handling as the free text search. This means the results for both searches are represented in the same list, replacing each other.

Parameters

  • SearchText: takes the string that should be used as search term for the search.
  • QueryID: takes the UID of the query object that should be used as search context.
  • (Optional) NavigateOnSingleResult: if this is set to true and a search returns only a single result the app will automatically navigate to the found object. By default its value is true.

Example

UWP

<AutoSuggestBox x:Name="Search"
...
   <interactivity:Interaction.Behaviors>
        <behaviors:AutoSuggestBoxInputBehavior>
            <core:InvokeCommandAction Command="{Binding CustomQuerySearchCommand}">
                <core:InvokeCommandAction.CommandParameter>
                    <controls:KeyValueList>
                        <controls:KeyValueParameter Key="SearchText" Value="{Binding ElementName=Search, Path=Text}" />
                        <controls:KeyValueParameter Key="NavigateOnSingleResult" Value="true" />
                        <controls:KeyValueParameter Key="QueryID" Value="bab1c694-a5ad-421f-8c85-faa385891e4b" />
                    </controls:KeyValueList>
                </core:InvokeCommandAction.CommandParameter>
            </core:InvokeCommandAction>
        </behaviors:AutoSuggestBoxInputBehavior>
    </interactivity:Interaction.Behaviors>
</AutoSuggestBox>

Xamarin

<SearchBar x:Name="SearchField"
  ...
       <behaviors:EventHandlerBehavior EventName="SearchButtonPressed">
            <behaviors:InvokeCommandAction Command="{Binding CustomQuerySearchCommand}">
                <behaviors:InvokeCommandAction.CommandParameter>
                    <classes:KeyValueList>
                        <classes:KeyValueParameter Key="SearchText"
                                                   Value="{Binding Path=Text, Source={x:Reference SearchField}}" />
                        <classes:KeyValueParameter Key="NavigateOnSingleResult" Value="true" />
                        <classes:KeyValueParameter Key="QueryID" Value="bab1c694-a5ad-421f-8c85-faa385891e4b" />
                    </classes:KeyValueList>
                </behaviors:InvokeCommandAction.CommandParameter>
            </behaviors:InvokeCommandAction>
        </behaviors:EventHandlerBehavior>
    </SearchBar.Behaviors>
</SearchBar>

See also