Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I'm trying to make an overview of all members filtering on multiple properties.
I have tried to use the memberService.GetMembersByPropertyValue() method, but this only allows you to filter on one property.
What would be the best way to filter on multiple properties?
Thanks in advance,
Maarten
Hi Maarten,
Are you using this in the frontend of your website or in the backoffice.
If it is the frontend i wouldn't recommend using the member Service because this will query the database and will resort in performance issues.
All member data is also stored in a lucene index so you could query that so you get optimal speed.
This is some code we have for querying the member index based on a property and a value. This can be adapted for multiple properties.
public static IEnumerable<int> GetMemberIdsWithPropertyUsingExamine(string property, string value) { var examineprovider = ExamineManager.Instance.SearchProviderCollection["InternalMemberSearcher"]; if (examineprovider != null) { var criteria = examineprovider.CreateSearchCriteria(); if (criteria != null) { var fields = new[] { property }; var operation = criteria.GroupedOr(fields, value).Compile(); var searchResults = examineprovider.Search(operation); return searchResults.Select(x => x.Id); } } return new List<int>(); }
Dave
For now Dave his example is the best way. There is a feature request to support this: http://issues.umbraco.org/issue/U4-6368
Jeroen
Hi Dave,
Thanks for your reply, this helped me a lot.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get members by multiple property values
Hello,
I'm trying to make an overview of all members filtering on multiple properties.
I have tried to use the memberService.GetMembersByPropertyValue() method, but this only allows you to filter on one property.
What would be the best way to filter on multiple properties?
Thanks in advance,
Maarten
Hi Maarten,
Are you using this in the frontend of your website or in the backoffice.
If it is the frontend i wouldn't recommend using the member Service because this will query the database and will resort in performance issues.
All member data is also stored in a lucene index so you could query that so you get optimal speed.
This is some code we have for querying the member index based on a property and a value. This can be adapted for multiple properties.
Dave
Hello,
For now Dave his example is the best way. There is a feature request to support this: http://issues.umbraco.org/issue/U4-6368
Jeroen
Hi Dave,
Thanks for your reply, this helped me a lot.
Maarten
is working on a reply...