Developer forum

Forum » CMS - Standard features » Using a smart search for a standard group

Using a smart search for a standard group

Gerard Kocks
Gerard Kocks
Reply

Hi,

We would like to set permissions on paragraphs based on data in a smart search. 
Since it is not possible to select a smart search to a paragraph my idea was to connect the smart search to the standard group (see screendump) and after that I can select this particular standard group to the paragraph for the permissions. 
Do you know if the standard group will be updated automatically when the smart search is updated?

Best regards
Gerard

Standard_Group.png

Replies

 
Nicolai Pedersen
Reply

You need to setup a schedule to update the group with the users, see dump

Capture.PNG
 
Nicole Busscher
Reply

Hi Nicolai, 

Thanks for your response. Unfortunately something doesn't work as expected. 

I created a smart group named 'AF Partners Russia standard group + smart search group' 
This smart search group consists of two rules:

1. Group is AF Partners Russia [do not adjust]

2. Group is AF Russian webinars 2018-2019

After that I created a new standard group named 'AF Russian webinars 2018-2019 - standard group combined with smart search' and this group is connected with the smart search group I created before. 

As you can see in my screendump the standard group consists of 234 users and the smart search has 235 users. I added the extra user this morning after I set up the scheduler, but after a few hours the extra user is still not in the standard group. What am I doing wrong? ;) 

Kind regards,

Nicole
 

download.png download_2.png download_3.png download_4.png
 
Nicole Busscher
Reply

Hi, can anyone help us further with this issue? 

Thanks! 

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Nicole

Could you post the URL for the website to Support please then we could have a look at it.

support@dynamicweb.dk

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

 
Nicole Busscher
Reply

Hi Kristian, 

Of course, I've sent you an email. 

BR, Nicole

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Nicole

Sorry for the late reply. This is unfortunately a bug. #59383
As workaround until fixed: 
Please edit and save the usergroup to update number of users in the group

Sorry for the inconvenience

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Kristian,

 

Could this fix be available in the 9.5 branch? I noticed it was fixed in 9.6, but we have a customer that needs this feature and we have a pending lauch, for which we don't want to upgrade to 9.6 given the amount of changes it has.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

You just update the Dynamicweb.Scheduling.Providers.GroupsAsSmartSearchesScheduledTaskAddIn package to 2.01

BR Nicolai

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

I've been trying to update that package, but I run into this error trying to restore the packages

https://www.screencast.com/t/BDxeEviC5N

 

How can I overcome this?

 

Best Regards,

Nuno

 
Nicolai Pedersen
Reply

That is an issue with our myget feeds.

You have to open you packages.config and change the version numbers manually and reload the project and restore packages.

Sorry, Nicolai

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

That worked, thanks.

 

Best Regards,

Nuno Aguiar

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

Despite what I said, the customer was complaining this was not working, so I had a test website up so I could handle this and in fact it is not.

  • I have the package updated
  • I run the scheduled task
  • The user group is not updated

https://www.screencast.com/t/aUncjTi7

 

Am I missing anything?

 

Best Regards,

Nuno Aguiar

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Nuno,

I've checked your scenario on DW957 has the package installed and was not able to reproduce the issue - proof, please have a look at Monitoring-Event viewer and report text of the error you have shown in the log. 

BR, Oleg QA

 

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Oleg,

 

This is what I have https://www.screencast.com/t/VNZpM0VvdM

 

It took a long time and eventually it timeout on other ocassions, but by manually removing the smart search, saving and then reapplying it. Can you suggest on what I can do now?

 

Best Regards,

Nuno Aguiar

 
Viktor Letavin Dynamicweb Employee
Viktor Letavin
Reply

Hi Nuno,

I've took a trip into your solution from link on video, and find out following:

1) Your solution still have old provider version of GroupsAsSmartSearchesScheduledTaskAddIn (see attachment 1)

2) Your solution have no error for updating packages via Package Manager - I've successfully updated Cybersource provider(you can see it in monitoring area evens -> info section)

3) Your solution have strange package related errors logged in monitoring.

According to 3rd above, I can guess that you somehow broke this package. We(with struging) managed to downgrade broken package, and update in to new version.

Anyway, I've managed to update group via scheduled task, you can see now it have same amount of users as the smartsearch have. But it took 2 scheduled task run, after first one only ~45 users were saved. This is because User.Save() throw timeout exception. The actual reason of this cannot be investigated without debug.
Also I would like to say that on the solution you testing - there are 4 groups with Smartsearch id set, but only 1 smartsearch. Every such group tries to resave users, that is also taking some time.

To troubeshout the problem we probably need test solution. 

BR, Viktor.

1.png 2.png
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi VIktor,

 

So there's the update:

  • I don't know how the package got downgraded. After you reported it I did notice it was in 1.0.2, but when I went to ask for additional help internally it was back to 2.0.1
    Anyway I believe it is not an issue for now
     
  • I understood what was wrong with user data. Our integration team had wrongly imported users without a username or password. Dynamicweb requires those 2 fields.
    We fixed that and it solved part of the issue
     
  • I removed the references to the deleted smart searches - I would expect that DW not only removes those references when a smart search is deleted, but also checks for it when trying to run the GroupsAsSmartSearchesScheduledTaskAddIn and/or Group.Save()
     
  • Nicolai had reached out to me about taking a look at the SQL indexes for users. We realized we had none and created one for it, but that did not speed this up a lot. 
    If you take a look at the screenshot, you can see there's a lot of time between executions, whereas the actual time spent for each execution is pretty fast.
    This points to something in the code that's taking a lot of time per user. 

 

Could normalizing the user-group relationship in a seperate table and/or a specific method to handle assigning users to groups instead of having to instantiate the entire user to update the group, be faster and more efficient? Looking at the SQL Profiler we can see how intensive the DB lookup is for every user and it seems to be doing a lot more than it needs to for this (updating user - group relationships)

 

Can you tell me what the next step is?

 

Best Regards,

Nuno Aguiar

SqlProfiler.png
 
Martin Vang
Martin Vang
Reply

Hi Nuno,

Just jumping in to with a quick notice about your suggestion to restructure the database.

I believe that changing the AccessUser table would be considered a major breaking change, so we wont do that for any 9.x releases. :)

I have, however, an epic that we might look at during DW 10, that is all about normalizing the AccessUser table. Might give a speedup, might not. Also might not have time to actually do it.

I've noted down that you asked for it and we will take that into consideration when we discuss what we want to focus on for DW 10.

 

Ill let Viktor get back to answering your questions. He seems to be better suited at it then I am, see as he already knows the setup. :)

BR

Martin

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Martin,

 

That sounds good. I do understand that normalizing the AccessUser table is more likely due for DW10.

 

Thank you for your comments. I'll wait on Viktor to see if we can optimize API methods and/or database interactions for these scenarios.

 

Best Regards,

Nuno Aguiar

 

 
Nicolai Pedersen
Reply

Hi Nuno

From your sql profiler it is the select * from accessuser where accessuserid = 1 that is slow. 5 secs. That indicates that your indexes on that table are not as they should be. Check your indexes of the accessusertable - and maybe share them here for us to see and compare with default Dynamicweb index.

Also do you happen to have user related notification subscribers? I see weird SQL that I cannot find in the code...

BR Nicolai

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

I'll ask Scott F and Scott S to help me get the answers related to SQL. They helped me out with that part. If nothing else, may help you realize if anything can be improved.

 

As for the User Notification Subscribers, I guess you nailed it. We do have notification from Live Integration set to OnUserSave, which we do need actually, to update the ERP whenever a user updates his profile. I guess we need to find a cleaver way to distinguish when a profile actually updated VS only some groups being added/removed frown. Any ideas?

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Inside the notification subscriber check if there is a httpcontext or not - and if that httpcontext contains information, i.e. URL or Name being posted, and only if that is present, send to ERP.

Votes for this answer: 1
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Great, that will work. Thank you so much.

 

Nuno

 

You must be logged in to post in the forum