Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Index dynamic profile pages


We have approx 6000 users (in a separate db) and a dynamic user profile page that shows user details.
A user id in the querystring of the profile page is used to show a specific user´s profile.

How can we use Find to index this dynamic page for each user so that all user profile pages will be searchable?

Feb 04, 2016 12:00

I suppose you could create a scheduled job where you: Get the users -> create user object -> include the user profile page in the user object -> index user objects.

If you are using UnifiedSearch, there are various ways to include the user objects in the unified search. Check out the documentation:

Feb 04, 2016 12:24

You can index any type of object with find so no problem at all. 

//Specifying the id by modifying the command
var user = ...get users and add profile information...
        x => x.Id = 42);
//Specifying that a property should be used as id or use client conventions for it
public class User
    public int Id { get; set; }
    public string UserName {get;set;}
    ...add profileinformation...
Scheduled job like Skuseth says above is great for triggering indexing. 
Then depending on how you want to show them you can either use UnifiedSearch (for a single global search page that shows all kinds of search hits) or a specified search for persons. If the latter you can use
var query = ...
var searchResult = client.Search<User>()
int numberOfDocsMatchingTheSearch = searchResult.TotalMatching;
int executionTime = searchResult.ServerDuration;
FacetResults facets = searchResult.Facets;
IEnumerable<SearchResultItem<User>> hits = searchResult.Hits;
Then loop through the hits to display them...

Don't you just love that strongly typed syntax of Find? :) 
Edited, Feb 04, 2016 12:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.