Jump to: navigation, search

Changes


Mobile Free Text Search (UBIK WinX)

4,124 bytes added, 16:38, 14 February 2022
Once a user is logged in and the [[Fast_Startup_(Client)#Optimization_regarding_object_loading_.28WinX_client.29|initial objects loading]] is finished, a search bar becomes available in the home page. The user can enter search criteria into the bar and wait for the results of the search which will start in the background.
 
== Search result ==
* When a search is finished, users can find a summary of its result (even if no matches are found).
* If too many matches are found, only the first 30 of them will be display.
 
 
== Search result quality ==
The quality of the search result are presented as percentages which depends on how many search criteria you entered were found for an object. E.g., if 2 out of 2 criteria were matched successfully, the respective object is regarded as a 100% (perfect) match. If 2 out of 3 criteria were found, it is a 66% match. Every object coming from the server is considered as a 100% match (for now). The result list is then sorted by the percentages in a descending order.
 
== Search criteria ==
The query then looks like the following:
{{Code|"Layer ID" 2}}
 
 
== Commands and customizing {{Version/WinXSince|4.0}} ==
There are two free text search related commands in ViewModel (the base type of almost all {{UBIK}} view models).
* FreeTextSearchCommand: Performs a search using the given parameter(s) immediately.
* DelayedFreeTextSearchCommand: Performs a search using the given parameter(s) if the same command is not executed again within the next half second. This is especially useful in scenarios where search results should be constantly updated as users type in the search terms.
The following types of command parameters are supported.
* String: Namely the search term(s)/text.
* KeyValueList: A collection of key-value pairs that allows multiple parameters to be delivered to a command. The following keys are supported. (see example below for detailed usage)
** SearchText: The search term(s)/text.
** NavigateOnSingleResult: In the case of only one perfect match (100%), whether the client app should automatically navigate to that matching object. Defaults to false.
 
=== Example with an input control ===
<tabs>
In the following example, a text input control is attached with two behaviors.
* When the text input is changed, a search is performed with a certain delay. And the search result can be displayed in additional UI.
* When the user explicitly confirms the input (using e.g. {{key press|Enter}} or the search button), an immediate search is performed and in case of only one perfect match, the client app automatically navigates to that matching object.
<tab name="UWP">
<source lang = "xml">
xmlns:behaviors="using:UBIK.WinX.Behaviors"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
<AutoSuggestBox...
x:Name="Search"
ItemsSource="{Binding SearchResultSelectorDialogViewModel.SearchResultList, Source={StaticResource Locator}}">
<interactivity:Interaction.Behaviors>
<behaviors:AutoSuggestBoxInputBehavior>
<core:InvokeCommandAction Command="{Binding FreeTextSearchCommand}">
<core:InvokeCommandAction.CommandParameter>
<controls:KeyValueList>
<controls:KeyValueParameter Key="SearchText" Value="{Binding ElementName=Search, Path=Text}" />
<controls:KeyValueParameter Key="NavigateOnSingleResult" Value="true" />
</controls:KeyValueList>
</core:InvokeCommandAction.CommandParameter>
</core:InvokeCommandAction>
</behaviors:AutoSuggestBoxInputBehavior>
<core:EventTriggerBehavior EventName="TextChanged">
<core:InvokeCommandAction Command="{Binding DelayedFreeTextSearchCommand}" CommandParameter="{Binding ElementName=Search, Path=Text}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AutoSuggestBox>
</source>
</tab>
 
<tab name="Xamarin">
<source lang = "xml">
xmlns:classes="clr-namespace:UBIK.CPL.Classes;assembly=UBIK.CPL"
xmlns:behaviors="clr-namespace:UBIK.CPL.Behaviors;assembly=UBIK.CPL"
<SearchBar...
x:Name="SearchField">
<SearchBar.Behaviors>
<behaviors:EventToCommandBehavior
Command="{Binding FreeTextSearchCommand}"
CommandParameter="{Binding Path=Text, Source={x:Reference SearchField}}"
EventName="SearchButtonPressed">
<behaviors:EventToCommandBehavior.CommandParameter>
<classes:KeyValueList>
<classes:KeyValueParameter Key="SearchText" Value="{Binding Path=Text, Source={x:Reference SearchField}}" />
<classes:KeyValueParameter Key="NavigateOnSingleResult" Value="true" />
</classes:KeyValueList>
</behaviors:EventToCommandBehavior.CommandParameter>
</behaviors:EventToCommandBehavior>
<behaviors:EventToCommandBehavior
Command="{Binding DelayedFreeTextSearchCommand}"
CommandParameter="{Binding Path=Text, Source={x:Reference SearchField}}"
EventName="TextChanged" />
</SearchBar.Behaviors>
</SearchBar>
</source>
</tab>
</tabs>
== Technical background ==