1. FindParse

    Artikel: AN0001627Aktualisiert: 21.09.2018
    Die vorgegebene Sprachenversion vom Artikeltext wird angezeigt, weil es kein Text von der ausgewählten Sprache und Version gibt.

    This object performs parsing of the input text. It will split it up into particular elements separated by space. It is possible define negation (by minus sign) or groups (by colon in front of the text) for the elements. Negation is used for exclusion of search results containg the defined text. Groups are used for enabling the user to state alternative names that mean the same (e.g. theme, thema, tema...).

    The result of parsing is returned in the collection of objects representing particular elements.

     

    Particlar elements are separated by a space. If you need to input a text containg a space, put it in quotation marks.

    Negation is defined by a minus sign in front of the text (without space between minus and text).

    Define the group in format: group_name:text

    Name Description
    void AddGroup(string groupCode, string groupAliases) Method adds group definition.
    FindItemList Parse(string text) Function parses the text and returns result elements.

    There is parameter groupCode of the method AddGroup returned in the parse results. Parameter groupAliases is group name that is search in the parsed text. More aliases can have the same group code, but one alias cannot be used at more group codes.

    Example

    Examples of text for parsing:

    prague

    It returns one element.

     

    prague marathon

    It returns two elements.

     

    prague -marathon

    It returns two elements. The latter one is marked as negation.

     

    "hello world" -marathon

    It returns two elements. The first with text hello world, the other with text marathon, that is marked as negation.

     

    prague cat:c1

    It returns two elements, where the latter one is marked as group cat.

     

    prague theme:t1 -cat:c2 "DB server"
    prague theme:t1 -cat:c2 -"DB server"

    It returns four elements:

    • prague
    • group theme with text t1
    • negation, group cat with text c2
    • text DB server, the second example also with negation

     

    prague theme:"t1 ufo" -cat:k2 cat:k3 "DB server"

    Vrátí pět elementů:

    • prague
    • skupina theme s textem t1 ufo
    • negace, skupina cat s textem c2
    • skupina cat s textem c3
    • text DB server

    Example of using groups for search

    We want to enable the user to search records by a ceratin column and at the same time enable to narrow the search according to record classification in another column. All this by a simple input into a text field without using filters. Classification is defined in column theme. According to the language preference users may input "theme", "theme", "tema", "téma" and also abbreviated "t". For unification we will use function AddGroup.

    AddGroup('theme', 'theme');
    AddGroup('theme', 'thema');
    AddGroup('theme', 'tema');
    AddGroup('theme', 'téma');
    AddGroup('theme', 't');

     If the user wants to search in category "objectgears" expression "model", all the stated options will be interpreted in the same way:

    • theme:objectgears model
    • thema:objectgears model
    • tema:objectgears model
    • téma:objectgears model
    • t:objectgears model
×