Developer forum

Forum » CMS - Standard features » User smart searches causing errors

User smart searches causing errors

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have noticed that on all Swift installations the task "Calculate users smart search results" always errors. I think this has to do with how the segments are set up as I see errors like this in the logs:

2022-12-21 08:41:09.152: Group 'No orders' was not updated. System.NullReferenceException: Object reference not set to an instance of an object.    at Dynamicweb.UserManagement.SmartSearchUserManagementExtensions.SetUsersBySmartSearch(Group group)    at Dynamicweb.Scheduling.Providers.GroupsAsSmartSearchesScheduledTaskAddIn.GroupsAsSmartSearchesScheduledTaskAddIn.Run()

and 

Group 'No sale in two months' was not updated. System.NullReferenceException: Object reference not set to an instance of an object.
Group 'Order over 50K in two months' was not updated. System.NullReferenceException: Object reference not set to an instance of an object.

I can't tell whether this is a DW bug / issue or a Swift issue, but either way it would be nice if this didn't error out of the box as it confuses people who manage / monitor the site.

Thanks!

Imar


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Imar,

 

A while back I worked with the Swift team to update the all User and Group type settings because it was preventing smart searches and users to be properly associated with them. What version of Swift are you using? This was changed in v1.15.0

 

You can check all of these files https://github.com/dynamicweb/Swift/tree/main/Swift/Files/System/UserTypes and compare with what you have.

 

 

I am not sure if that will fix your issue, but could be a hint.

 

Best Regards,

Nuno Aguiar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I've seen it with recent Swift versions as well. Like I said, it may not be Swift-sepcific, but related to how Smart Searches are handled.

 
Suzi Louring
Reply

Hi Imar

I think you need these files - see screendump.

They haven't been there since Swift 1.14, which I have reported to the Swift team

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Happy New Year Suzi!

Yes, that made the problem go away. Thank you!

I'd be interested to know how that works under the covers. Is it by name that a Segment is mapped to a Smart Search? I can't see a way to select or configure it otherwise... And it would be nice if the Swift team could fix this.

Thanks!

Imar

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Imar,

 

The ability to see the smart searches in User Groups is what was fixed already in v1.15.0 that I pointed out (I was involved in that, so that's how I know). What version are you using?

 

Regarding the Smart Search xml files, I can see they are not in Git (and looks like they never were). I can't speak about that part.

 

Best Regards,

Nuno Aguiar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I am talking about the backend Segments under Users. Those are added by Swift AFAIK, but the underlying Smart Search functionality connecting the segements to a Smart Search is in the core platform, not Swift no?

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Imar,

 

You are not wrong, however:

  • Yes, the core platform allows you to associate Smart Searches to User Groups
  • The core platform also allows you to configure User and Group Types  
    essentially this allows a parent-child relationship and hides some fields in the UI

 

What the Swift team did in the clean database was:

  • Created some Smart Searches (the files Suzi showed) - but they are not in Github
  • Setup the "User and Group types" (i.e. Segments)
  • Created user groups (i.e. "No sale in two months")
  • Associated the smart search with the User Groups
  • At some point in time the User and Group Types where updated and the ability to assign a smart search to a user group was hidden (and some parent-child relationships too)
  • In v1.15, the "User and Group types" settings were fixed
    • But the Smart searches were still not added to Github
  • Despite this, the AccessUser table records are still referencing the smart search GUID (although the files are not there)
    This is what I believe you are experiencing

 

So, in summary

  • The Swift team provides
    • Smart Searches (xml files)
    • User and Group types (xml files)
    • User Groups properly configured (database records)
  • Currently smart searches (files) are missing, which I believe causes the "Calculate users smart search results" task to trigger errors, by not finding them correctly

 

Does that make sense? Or am I missing something?

 

Best Regards,

Nuno Aguiar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yes, thanks, I am aware of all of that :-) I just didn't realize that the ability to choose a smart search on the Segment type had been removed with the user type configuration. That realization, combined with Suze's report of the Swift team not shipping these smart searches (but apparently shipping the Segments definition depending on those smart searches) made the connection.

Thanks!

Imar

 

You must be logged in to post in the forum