Use custom fields for search

In my code I am using Fieldfilter to search a list like the following and I want to know how to assign the the member value to search for results with member value of both 0 and 1

FieldFilter memberFilter = new FieldFilter();

memberFilter.FieldName = "profile_IsMember";

memberFilter.FieldValue = member;

options.FieldFilters.Add(memberFilter);

  • I think the only way to achieve this is to avoid using a field filter and pass it in on the query string

    <existing query> AND (profile_IsMember:0 OR profile_IsMember:1)

  • In reply to Robert Nash:

    Another question I have is about a task is run by a scheduled cron job from tasks.config.  My question is how do I run this task manually for debugging purposes.  I want to check if the task has any bugs.

    Thanks

  • In reply to asme_cheng:

    Run your job scheduler and in Visual Studio you'll have to debug->attach to process and attach to the Telligent Job Scheduler process.  Then wait until your job fires.

  • In reply to Luke D:

    Sorry but how do I run the job scheduler manually?  I have something like the following in tasks.config but I need to run the task just one time manually to debug it.   Thanks

    <job schedule="0 * * * * ? *" type="ASMEWeb.ASME.Tasks.MemberStatusUpdate, ASMEWeb" />

  • In reply to asme_cheng:

    Hi Cheng,

    Are you talking about simply executing the exe file? If you navigate to the Task folder where your Job Scheduler lives, you'll find a file called Telligent.JobScheduler.Service.exe. Double-clicking this (or right-click, run as Administrator) will start the Job Scheduler.

    Be sure to first disable the Job Scheduler windows services before executing it manually. You don't want to have two of them running at the same time.

    Zac

  • In reply to Zac Elsik:

    Hi I only want to run the single task MemberStatusUpdate as indicated in the job scheduler.  Also do I set up the job scheduler to execute task every 2 hours between 8pm and 6 am every single day using the task.config like the following?

    <job schedule="0 20-6/2 * * * *" type="ASMEWeb.ASME.Tasks.MemberStatusUpdate, ASMEWeb" />

  • In reply to asme_cheng:

    Is this a production site?  If not, just change your schedule to something more frequent while testing it

  • In reply to Robert Nash:

    Hi I am using the following code to update the user profile_IsMember to 1 so all users become members.  But when I do a new search afterward it seems nothing get updated.  Can you see what I did wrong?

           static void UpdateUserMemberStatus(User user)

           {

               string memberStatus = "1";

               UsersUpdateOptions userOptions = new UsersUpdateOptions();

               ProfileField profileMemberStatus = new ProfileField { Label = "IsMember", Value = memberStatus };

               if (user.Id == null) return;

               userOptions.Id = user.Id.Value;

               userOptions.ProfileFields = new List<ProfileField> { profileMemberStatus };

               PublicApi.Users.Update(userOptions);

           }

  • In reply to Zac Elsik:

    Hi where is the Task folder so I can run the exe file you just mentioned.

    Thanks

  • In reply to asme_cheng:

    It ships with the platform.  telligentcommunitysuite-7.6.0.33272\Tasks  is where mine is (for my version). Do you have a working site up and running locally???

  • In reply to Luke D:

    So if I right click on Telligent.JobScheduler.Service.exe to run as Administrator does it merely start the job scheduler or does it manually run all the tasks in the job scheduler.  I have a task set up like this in tasks.config

    <job schedule="0 0 2 ? * SUN" type="ASMEWeb.ASME.Tasks.MemberStatusUpdate, ASMEWeb" />

  • In reply to asme_cheng:

    First, confirm the user profile data was update - run the following sql: You should see 'IsMember' stored.

    select * from cs_Profile_UserData where UserID = xxxx


    Confirm you have copied your your assembly to the both the web folder AND the job service folder. This is important.

    You already have your job service setup, correct? When you run Telligent.JobScheduler.Service.exe it will run all of the tasks in tasks.config. If you want to test your own create a backup of your current one so its easy to revert back to and comment out all of the other task

    As previously mentioned, have the job run frequently and you can attach to this process to test your job.  

  • In reply to Kevin Cunningham:

    My next question is how do I add all the users to the solr search engine so that somebody can search the user directory

  • In reply to asme_cheng:

    I believe users are indexed automatically - however I believe the job scheduler does the indexing so you need to have that running in order for it to work

  • In reply to Luke D:

    I am using the following code in my job scheduler to update users in Solr but it seems not to work

                           //create a new extentedattribute ActiveMember to update DB

                           List<ExtendedAttribute> extendedAttrs = new List<ExtendedAttribute>() { new ExtendedAttribute { Key = ProfileConstants.IsMember, Value = activeMemberString } };

                           //create a ProfileField to update SOLR

                           ProfileField profileMemberStatus = new ProfileField { Label = "IsMember", Value = activeMemberString };

                           UsersUpdateOptions userOptions = new UsersUpdateOptions()

                           {

                               Id = telligentUser.Id.Value,

                               ExtendedAttributes = extendedAttrs,

                               ProfileFields = new List<ProfileField> { profileMemberStatus }

                           };

                           PublicApi.Users.Update(userOptions);

Related