Jump to: navigation, search

Mobile Free Text Search (UBIK WinX)


On UBIK® WinX, you have the possibility to search for objects by free text input.

The search bar
The search result dialog
Search in progress (bar)
Search in progress (dialog)
Search dialog displaying truncated result

Search bar

Once a user is logged in and the 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

If there is only a single 100% (perfect) match, the app will immediately navigate to it. If multiple perfect matches are found, they will be presented in a search result dialog.

, searches are performed as you type the search terms/text in the search bar (with a half second delay after the typing stops). And the search results are updated and presented in the drop down list of the search bar instead of in a dialog. For ways to customize the UI and the search behaviors, please refer to Commands and customizing.

IC Hint square.pngIf the search result dialog is still needed (e.g. for existing UI customizings), you can set the value of the UICompatibilityLevel setting to below 400.

Online and offline search

A mobile free text search is always performed against the data available on the device. Additionally, an online server search is executed if both

  • The server is reachable and the app is not in offline mode;
  • A free text search query is provided by the server.

Presenting of results

Since there is a delay between the delivery of offline and online results (online search is much slower because it involves network), UBIK® presents the offline result first if possible and hints the users that more search is in progress. The online result might be presented later in different scenarios.

  • In case the offline search finds only one matching object, UBIK® will immediately navigate to that object;
    • If the online search later finds the same matching object, nothing will happen. Or if a different match is found, UBIK® will navigate again, this time to that new one;
    • If the online search later finds more than one matching object, a dialog will be used to present these objects.
  • In case the offline search finds more than one matching object, a dialog will be used to present these objects;
    • Any additionally matches found during the online search will be merged into that dialog;
    • If the user presses OK or Cancel to dismiss the dialog before the online search finishes, the online result will be ignored.

Search status indication

  • Whenever a search operation is in progress, users can find the indication of that in UBIK®.
    • The hint in the search box;
    • The hint in the search result dialog (if a dialog is shown).
  • 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 text you provide in the input field is processed into search criteria objects before actually executing the search. An understanding of this mechanism and how to write a search query that is comprehensive for it will benefit your ability to find objects.

Examples:

  • Pressure 32.8 - Will find objects having a property "Pressure" with the value 32.8.
  • "Pump inspection" 2015-05-27 - Will find objects named "Pump inspection" with a date property that says 2015-05-27.

Interpreting search inputs

By default, the search input is divided into search criteria by the blank characters ( ) in it. Every word counts as a separate criterion. In order to search texts with blank characters in them, we can use the double quote signs ("") to group words into a single criterion.

In the example above, the input would be interpreted as 3 criteria ("Pump", "inspection" and "2015-05-27") without the double quote signs.

Property descriptions

If a meta property is found that matches a criterion, all found property values are filtered by it. This way, you can specify your search efficiently.

For example, imagine searching for a value like "2". It will be found extremely often, so without further specification, you will get all kinds of results. Adding the meta property description "Layer ID" will result in a way better result.

The query then looks like the following: "Layer ID" 2


Commands and customizing

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

In the following example, two behaviors are attached to a text input control.

  • 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. 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.

UWP

xmlns:behaviors="using:UBIK.WinX.Behaviors"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:controls="using:UBIK.WinX.Controls"
<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>

Xamarin

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>

Technical background

The user entered criteria are all regarded as texts and compared against the following.

  1. Display strings of content objects;
  2. Displayed values of properties;
  3. Descriptions of meta properties.

The 2nd point is worth mentioning in particular because it means users can search by what they see instead of the actual values behind the properties. This can be quite helpful in the cases below.

Search by selective list items

The selective list items usually have system internal values (such as coded integer numbers) that are hard to comprehend for the users. That is why they are also configured with some more understandable descriptions.

Imagine a status color property having a value "-16711936" and the corresponding selective list item having the description "green". The user can find the object by searching for "green" instead of " -16711936".

Search by Guid/linked properties

The values of Guid/linked properties are, by definition, Guids of objects to which properties are linked. Since their values are hard to comprehend for the users, they usually also come with more meaning display strings (such as the names of the linked objects).

Imagine a scan reference property having a value "BA732E84-58C6-4859-A8D0-97770D7DB8A9" and a display string "PU212". The user can find the object by searching for the latter.


Known issues

  • Time zone change of the device might render DateTime based searches non-functional.