Kernel::System::FAQSearch

NAME

Kernel::System::FAQSearch – FAQ search lib

DESCRIPTION

All FAQ search functions.

PUBLIC INTERFACE

FAQSearch()

search in FAQ articles

    my @IDs = $FAQObject->FAQSearch(

        ItemID => 4,                                                  # (optional)
        ItemID => [ 4, 5, 6 ],                                        # (optional)

        ExcludeItemID => 4,                                           # (optional)
        ExcludeItemID => [ 4, 5, 6 ],                                 # (optional)

        Number    => '*134*',                                         # (optional)
        Title     => '*some title*',                                  # (optional)

        # is searching in Number, Title, Keyword and Field1-6
        What      => '*some text*',                                   # (optional)

        Keyword   => '*webserver*',                                   # (optional)
        States    => {                                                # (optional)
            1 => 'internal',
            2 => 'external',
        },
        LanguageIDs => [ 4, 5, 6 ],                                   # (optional)
        CategoryIDs => [ 7, 8, 9 ],                                   # (optional)
        ValidIDs    => [ 1, 2, 3 ],                                   # (optional) (default 1)

        # Approved
        #    Only available in internal interface (agent interface)
        Approved    => 1,                                             # (optional) 1 or 0,

        # Votes
        #   At least one operator must be specified. Operators will be connected with AND,
        #       values in an operator with OR.
        #   You can also pass more than one argument to an operator: [123, 654]
        Votes => {
            Equals            => 123,
            GreaterThan       => 123,
            GreaterThanEquals => 123,
            SmallerThan       => 123,
            SmallerThanEquals => 123,
        }

        # Rate
        #   At least one operator must be specified. Operators will be connected with AND,
        #       values in an operator with OR.
        #   You can also pass more than one argument to an operator: [50, 75]
        Rate => {
            Equals            => 75,
            GreaterThan       => 75,
            GreaterThanEquals => 75,
            SmallerThan       => 75,
            SmallerThanEquals => 75,
        }

        # create FAQ item properties (optional)
        CreatedUserIDs => [1, 12, 455, 32]

        # change FAQ item properties (optional)
        LastChangedUserIDs => [1, 12, 455, 32]

        # DynamicFields
        #   At least one operator must be specified. Operators will be connected with AND,
        #       values in an operator with OR.
        #   You can also pass more than one argument to an operator: ['value1', 'value2']
        DynamicField_FieldNameX => {
            Equals            => 123,
            Like              => 'value*',                # "equals" operator with wild-card support
            GreaterThan       => '2001-01-01 01:01:01',
            GreaterThanEquals => '2001-01-01 01:01:01',
            SmallerThan       => '2002-02-02 02:02:02',
            SmallerThanEquals => '2002-02-02 02:02:02',
        }

        # FAQ items created more than 60 minutes ago (item older than 60 minutes)  (optional)
        ItemCreateTimeOlderMinutes => 60,
        # FAQ item created less than 120 minutes ago (item newer than 120 minutes) (optional)
        ItemCreateTimeNewerMinutes => 120,

        # FAQ items with create time after ... (item newer than this date) (optional)
        ItemCreateTimeNewerDate => '2006-01-09 00:00:01',
        # FAQ items with created time before ... (item older than this date) (optional)
        ItemCreateTimeOlderDate => '2006-01-19 23:59:59',

        # FAQ items changed more than 60 minutes ago (optional)
        ItemChangeTimeOlderMinutes => 60,
        # FAQ items changed less than 120 minutes ago (optional)
        ItemChangeTimeNewerMinutes => 120,

        # FAQ item with changed time after ... (item changed newer than this date) (optional)
        ItemChangeTimeNewerDate => '2006-01-09 00:00:01',
        # FAQ item with changed time before ... (item changed older than this date) (optional)
        ItemChangeTimeOlderDate => '2006-01-19 23:59:59',

        OrderBy => [ 'FAQID', 'Title' ],                              # (optional)
        # default: [ 'FAQID' ],
        # (FAQID, Number, Title, Language, Category, Valid, Created,
        # Changed, State, Votes, Result)

        # Additional information for OrderBy:
        # The OrderByDirection can be specified for each OrderBy attribute.
        # The pairing is made by the array indexes.

        OrderByDirection => [ 'Down', 'Up' ],                         # (optional)
        # default: [ 'UP' ]
        # (Down | Up)

        Limit     => 150,

        Interface => {              # (default internal)
            StateID => 3,
            Name    => 'public',    # public | external | internal
        },
        UserID    => 1,
    );

Returns:

    @IDs = (
        32,
        13,
        12,
        9,
        6,
        5,
        4,
        1,
    );

PRIVATE FUNCTIONS

_InConditionGet()

internal function to create an

    table.column IN (values)

condition string from an array.

    my $SQLPart = $TicketObject->_InConditionGet(
        TableColumn => 'table.column',
        IDRef       => $ArrayRef,
    );
Scroll to Top