Can the search results on the member search page be sorted by an ExtendedAttributes or ProfileFields field?
Can the search results on the member search page be sorted by an ExtendedAttributes or ProfileFields field?
That event gets fired before altered users get changed in the index, which varies by how often the job runs and how many changes need to be processed. You still will have to store this value somehow and read it when the event is fired
I've attempted to write some code for this. Would this work as a widget extension?
public class MyUsers
{
public Telligent.Evolution.Extensibility.Api.Entities.Version1.SearchResults GetUsers(int pageIndex, int pageSize, string filters, string query)
{
ISearchResults search = Apis.Get<ISearchResults>();
var searchOptions = new SearchResultsListOptions
{
PageIndex = pageIndex,
PageSize = pageSize,
Query = query,
Filters = filters
};
searchOptions.Sort = "UserSortOrder";
var results = search.List(searchOptions);
return results; //Apis.Get<Users>().List(options);
}
public void BeforeSearchBulkIndexingEventHandler(BeforeBulkIndexingEventArgs e)
{
SearchIndexDocument d = new SearchIndexDocument();
d.AddField("UserSortOrder", GetSortOrder(d.ContentId));
e.Documents.Append(d);
}
private string GetSortOrder(Guid contentId)
{
SqlDataAccess sd = new SqlDataAccess();
using (SqlCommand cmd = sd.GetCommand("ibby_UserSortOrder_Get"))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ContentId", contentId);
DataTable dt = sd.Execute(cmd);
if (dt.Rows.Count > 0)
return dt.Rows[0]["UserSortOrder"].ToString();
else
return string.Empty;
}
}
}