1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RM 1.2 Search or filter custom fields

Discussion in 'Resource Manager Support' started by querschlaeger, Feb 29, 2016.

  1. querschlaeger

    querschlaeger Member

    Hello,

    I want to know how I can search or filter the custom field values.

    Thanks!
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The content isn't indexed so can't be searched.

    Nor are there any filtering options available.
     
  3. Slion

    Slion Member

    Too bad, that would be neat.
     
  4. Slion

    Slion Member

    So resource fields content are not being searched by the standard search functionality?
     
  5. Slion

    Slion Member

    I just checked that and it looks like title and description fields are searched but custom fields are not.
    That's a rather unfortunate limitation.
     
  6. Slion

    Slion Member

    As I was making my TOC add-on Resource Manager friendly I've dumped the view parameters provided on resource page:
    (array)resource:
    ----resource_id:2
    ----title:Lian-Li PC-S80 (ATX)
    ----tag_line:Silent computer case
    ----user_id:1
    ----username:My User Name
    ----resource_state:visible
    ----resource_date:1492531143
    ----resource_category_id:2
    ----current_version_id:2
    ----description_update_id:2
    ----discussion_thread_id:32
    ----external_url:
    ----is_fileless:1
    ----external_purchase_url:
    ----price:0
    ----currency:
    ----download_count:0
    ----rating_count:0
    ----rating_sum:0
    ----rating_avg:0
    ----rating_weighted:3
    ----update_count:0
    ----review_count:0
    ----last_update:1492531143
    ----alt_support_url:
    ----had_first_visible:1
    ----custom_resource_fields:a:3:{s:13:"hardware_type";s:13:"computer_case";s:5:"brand";s:7:"Lian_Li";s:5:"model";s:6:"PC-S80";}
    ----prefix_id:0
    ----icon_date:0
    ----tags:a:1:{i:29;a:2:{s:3:"tag";s:13:"computer-case";s:7:"tag_url";s:13:"computer-case";}}
    ----version_string:2017-04-18
    ----release_date:1492531143
    ----download_url:
    ----version_rating_count:0
    ----version_rating_sum:0
    ----version_download_count:0
    ----email:webmaster@example.com
    ----gender:
    ----custom_title:Founder
    ----language_id:1
    ----style_id:6
    ----timezone:Europe/London
    ----visible:1
    ----activity_visible:1
    ----user_group_id:2
    ----secondary_group_ids:3
    ----display_style_group_id:3
    ----permission_combination_id:11
    ----message_count:34
    ----conversations_unread:0
    ----register_date:1489859612
    ----last_activity:1492608969
    ----trophy_points:6
    ----alerts_unread:0
    ----avatar_date:1489956132
    ----avatar_width:192
    ----avatar_height:200
    ----gravatar:
    ----user_state:valid
    ----is_moderator:1
    ----is_admin:1
    ----is_banned:0
    ----like_count:0
    ----warning_points:0
    ----is_staff:1
    ----resource_count:2
    ----dob_day:28
    ----dob_month:8
    ----dob_year:1976
    ----status:
    ----status_date:0
    ----status_profile_post_id:0
    ----signature:
    ----homepage:http://example.com
    ----location:MyTown
    ----occupation:Software Engineer
    ----following:
    ----ignored:
    ----csrf_token:zWTGafXiwMNH0BtN7F1LhEacbRe8J5J9VtSzkg9f
    ----avatar_crop_x:0
    ----avatar_crop_y:0
    ----about:About Me
    ----custom_fields:a:6:{s:3:"aim";s:0:"";s:8:"facebook";s:0:"";s:3:"icq";s:0:"";s:5:"skype";s:0:"";s:7:"twitter";s:0:"";s:5:"yahoo";s:0:"";}
    ----external_auth:
    ----password_date:1489859612
    ----attachment_id:
    ----attachment_view_count:
    ----attachment_filename:
    ----attachment_file_size:
    ----delete_date:
    ----delete_reason:
    ----delete_user_id:
    ----delete_username:
    ----feature_date:
    ----is_watched:0
    ----last_download_date:0
    ----isCensored:1
    ----isFilelessNoExternal:1
    ----(array)tagsList:
    --------(array)29:
    ------------tag:computer-case
    ------------tag_url:computer-case
    ----cost:
    ----rating:0
    ----version_rating:0
    ----canDownload:1
    ----canEdit:1
    ----canEditTags:1
    ----canEditIcon:1
    ----canReassign:1
    ----canDelete:1
    ----canUndelete:
    ----canFeatureUnfeature:1
    ----canApprove:
    ----canUnapprove:1
    ----canRate:
    ----canRateIfDownloaded:
    ----canWatch:
    ----canAddUpdate:1
    ----canAddVersion:1
    ----canViewPreview:1
    ----canInlineMod:1
    ----(array)customFields:
    --------hardware_type:computer_case
    --------brand:Lian_Li
    --------model:pC-S80
    ----(array)externalAuth:
    ----isTrusted:1
    ----isIgnored:
    ----canCleanSpam:
    ----showExtraInfoTab:
    ----(array)customFieldTabs:
    (array)category:
    ----resource_category_id:2
    ----category_title:Hardware
    ----category_description:Hardware inventory and reviews
    ----parent_category_id:0
    ----depth:0
    ----lft:3
    ----rgt:4
    ----display_order:1
    ----resource_count:1
    ----last_update:1492531143
    ----last_resource_title:Lian-Li PC-S80 (ATX)
    ----last_resource_id:2
    ----category_breadcrumb:a:0:{}
    ----allow_local:1
    ----allow_external:1
    ----allow_commercial_external:1
    ----allow_fileless:1
    ----thread_node_id:6
    ----thread_prefix_id:0
    ----always_moderate_create:0
    ----always_moderate_update:0
    ----field_cache:a:1:{s:10:"above_info";a:3:{s:13:"hardware_type";s:13:"hardware_type";s:5:"brand";s:5:"brand";s:5:"model";s:5:"model";}}
    ----prefix_cache:
    ----require_prefix:0
    ----featured_count:0
    ----min_tags:0
    ----(array)categoryBreadcrumb:
    ----allowResource:1
    ----canAdd:1
    ----(array)fieldCache:
    --------(array)above_info:
    ------------hardware_type:hardware_type
    ------------brand:brand
    ------------model:model
    (array)update:
    ----resource_update_id:2
    ----resource_id:2
    ----title:Lian-Li PC-S80 (ATX)
    ----message:[TOC][/TOC] Silent computer case PC-S80.
    ----message_state:visible
    ----post_date:1492531143
    ----attach_count:0
    ----likes:0
    ----like_users:a:0:{}
    ----ip_id:0
    ----had_first_visible:1
    ----warning_id:0
    ----warning_message:
    ----like_date:
    ----user_id:1
    ----isCensored:1
    ----canLike:
    ----canReport:1
    ----canEdit:1
    ----canDelete:
    ----canUndelete:
    ----canWarn:
    ----isDescriptionUpdate:1
    ----isTrusted:1
    ----messageHtml:XenForo_BbCode_TextWrapper
    isLimited:
    (array)updates:
    showReadAllUpdates:
    canViewImages:1
    canViewWarnings:1
    (array)reviews:
    (array)ignoredReviewNames:
    showMoreReviews:
    Silent computer case PC-S80.

    Now looking at the source code of the Resource Manager it looks like it could be possible to override/modify XenResource_Search_DataHandler_Update::_insertIntoIndex to include custom fields values as part of the indexer message data. We could use $data['customFields'] to access field values or get access to the fields some other way.
     
    Last edited: Apr 19, 2017
  7. Slion

    Slion Member

    I wonder if an add-on with a Code Event Listener for load_class_search_data and a hint set to XenResource_Search_DataHandler_Update could do that.
     
  8. Slion

    Slion Member

Share This Page