Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andreas Persson 27 posts 78 karma points
    Mar 17, 2015 @ 23:58
    Andreas Persson
    0

    Member Groups

    Hi, has any one got the filter working with member groups?

  • Robert Foster 459 posts 1820 karma points MVP 3x admin c-trib
    Mar 19, 2015 @ 22:49
    Robert Foster
    0

    Hi Andreas,

    For this to work, you'd need to firstly configure the Examine InternalMemberIndexSet index to include the groups that each member belongs to.  You would also need to hook into the Examine indexing events to add the member groups to the index when a member is saved etc.

    Once the data is in the index, it's then a matter of editing the filter.html and member.filter.controller.js files to include the Member Group filter (you could use the Member Type as an example); and you may want to create an ApiController to return the list of Member groups (or you could hard-code the list for now).

    If you want to take a look at the source code for the member list view it can be found on GitHub here: https://github.com/robertjf/umbMemberListView contributions are more than welcome - and you'll get a clearer idea of what's required by taking a look at that.

    Hope that helps, if you need further assistance, feel free to PM me and I'll see what I can do.

    - Rob.

  • Richard Hamilton 79 posts 169 karma points
    Oct 06, 2016 @ 16:36
    Richard Hamilton
    0

    Do you have an example of how to do this? I want to add my own custom filter for location.

  • David Armitage 508 posts 2078 karma points
    Aug 30, 2017 @ 09:58
    David Armitage
    0

    Hi,

    Anyone got any answers on this. I am generally having trouble searching any custom member fields using Examine.

    I read somewhere that the searchable fields for member are hard coded and no way of searching custom fields.

    Anyone know about this?

    Kind Regards

    David

  • David Armitage 508 posts 2078 karma points
    Aug 31, 2017 @ 04:12
    David Armitage
    0

    Hi Guys,

    I got examine searching working on the members. I had to create a custom indexer & searcher.

    Here is what I did.

    First - I create a new IndexSet within the ExamineIndex.config.

    <IndexSet SetName="ExternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/ExternalMember/" />
    

    Second - I created a new Indexer within the ExamineSettings.config. This needs adding within ExamineIndexProviders/providers.

     <add name="ExternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine" supportUnpublished="true" supportProtected="true" />
    

    Third - I created a new Searcher within the ExamineSettings.config. This needs adding within ExamineSearchProviders/providers.

    <add name="ExternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" analyzer="Lucene.Net.Analysis.KeywordAnalyzer, Lucene.Net" indexSets="ExternalMemberIndexSet"/>
    

    NOW YOU SHOULD BE ABLE TO SEARCH CUSTOM FIELDS!!!


    Here is an example of one of my simple member searches.

    var searcher = Examine.ExamineManager.Instance.SearchProviderCollection["ExternalMemberSearcher"];
    var criteria = searcher.CreateSearchCriteria(BooleanOperation.And);
    criteria.NodeTypeAlias("companyProfile").And();
    
    if (search.Display != null)
    {
        criteria.Field("display", search.Display.Value ? "1" : "0").And();
    }
    
    if (search.Active != null)
    {
        criteria.Field("active", search.Active.Value ? "1" : "0").And();
    }
    
    if (search.Validated != null)
    {
        criteria.Field("validated", search.Active.Value ? "1" : "0").And();
    }
    
    if (search.IsEmployer != null)
    {
        criteria.Field("isEmployer", search.IsEmployer.Value ? "1" : "0").And();
    }
    
    if (search.IsAgency != null)
    {
        criteria.Field("isAgency", search.IsAgency.Value ? "1" : "0").And();
    }
    
    if (search.IsServiceProvider != null)
    {
        criteria.Field("isServiceProvider", search.IsServiceProvider.Value ? "1" : "0").And();
    }
    
    if (search.Keywords != null && search.Keywords.Count > 0)
    {
        var searchTerms = search.Keywords.Select(x => x.Fuzzy());
        criteria.GroupedOr(new[] { "companyName", "summary", "details1","details2","details3" }, searchTerms.ToArray()).And();
    }   
    
    var searchResults = searcher.Search(criteria);
    

    Hope this helps someone. It look we a while to figure out.

    Kind Regards

    David

  • Robert Foster 459 posts 1820 karma points MVP 3x admin c-trib
    Jan 18, 2020 @ 02:03
    Robert Foster
    0

    in case anyone's interested, Member Group filtering is now available out of the box with the latest version :)

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft