A simple yet incredably hard question to find anwsers to:
I'm making a search feature on my site and I would like users to filter the members on the site depending on some properties, so how do I filter members using razor?
I'm going to have quite many members, so the search has to be able to handle a lot of members.
How about querying the defulat InternalMember Lucene index via Examine ? or using an XPath expression to get the members via uQuery with uQuery.GetMembersByXPath(xpath);
Search/Filter members by property
Hi!
A simple yet incredably hard question to find anwsers to:
I'm making a search feature on my site and I would like users to filter the members on the site depending on some properties, so how do I filter members using razor?
I'm going to have quite many members, so the search has to be able to handle a lot of members.
Hope anyone has an anwser.
Thanks
the last time I checked it couldn't been done. Had to fiddle with SQL queries.
Hi,
How about querying the defulat InternalMember Lucene index via Examine ? or using an XPath expression to get the members via uQuery with uQuery.GetMembersByXPath(xpath);
Sounds good, would that perform?
I have been fiddling with this for some time, and i think i have succeeded.
The trick seems to be to filter the members by Member Type first:
var siteMembers = Member.GetAll.Where(x => x.ContentType.Alias == "MyUsers");
Then I'm able to search the properties without running into errors like: Object doesn't contain bla bla bla...
siteMembers = siteMembers.Where(x => x.getProperty("age").Value.ToString().Contains(Request["age"]));
I have not tested the speed on this with a large member base, but it does the trick for me :)
Hope it helps anyone.
My experience is that as soon as you go through the umbraco membership api it gets to slow with 100+ members.
with umbraco 7.x you can use method
GetMembersByPropertyValue("propertyalias", "value");
Returns all Members, of any type, with a mathcing value in the property with the given property alias
is working on a reply...