Smart Search | Index Type | Custom Index

pankaj saxena asked on October 10, 2022 12:23

Hi Team,

I'm working on the smart search functionality in kentico 12, the smart search result not same in CMS and Live site, Means both result are different.

Could you tell me what is the issue.

Recent Answers


Brenden Kehren answered on October 10, 2022 15:30

Are you using Portal Engine or MVC development?

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on October 11, 2022 07:21

Hi Breden,

Using the MVC Development. In the local code its working fine and both cms and local site search is working fine and return result same. But I'm checking same result in the live both cms and live page search result is different and something the live search not working but the cms search is working fine.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 13, 2022 15:11

Sounds like you may have an issue with the web farm servers not syncing the data back and forth between the MVC site and the CMS site. Check out this page for some troubleshooting tips.

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on October 14, 2022 15:49

Hi Brenden,

I checked the local code again take a update code from the Develop branch and observe these points:

  1. If I'm using the page type index so the index working fine in both CMS and Live MVC page.
  2. If I'm using the custom type page index so in that case on the CMS search is working not in Live MVC page.

And as per my requirement I need to use Custom type search but currently the custom search not working in Live MVC Site.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 14, 2022 16:37

Pankaj,

What I'm talking about is the Web Farm application within Kentico isn't functioning as you'd expect. There is most likely something failing. The search index data should be in both the CMS website and the MVC website under the /App_Data/CMSModules/SmartSearch/<indexname>/ folder.

If you don't see that in the live site then check the permissions for the app_pool user (typically IIS_USRS) has read/write access to the /App_Data directory. If it does, then check the Web Farm app in Kentico and see if there are a bunch of tasks in there. IF there are, I'd suggest deleting them and allowing the server to get caught up.

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on October 18, 2022 09:25 (last edited on October 18, 2022 09:26)

Hi Brenden,

I checked both folder in my local system /App_Data/CMSModules/SmartSearch/<indexname> not sync in real time on the MVC application.

Some of the file is synced into the MVC application but the main file not sync. So I need to know what is the issue on my local. If I'm resolve that issue into my local maybe I'll resolve the same issue on prod.

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on October 18, 2022 10:28 (last edited on October 18, 2022 10:28)

Hi Brenden,

Attaching the compare folder images link.

https://ibb.co/fXmkTQF

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 7, 2022 11:54

Hi @Brenden,

Not find any solution for the web farm sync issue for the custom search index.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 7, 2022 12:44

Delete all the files in both locations and try to rebuild the index again. If you cannot delete the files, stop the app pool for the respective site and try deleting them again.

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 7, 2022 12:47

Hi @Brenden,

I have already deleted the files form the both location in MVC and CMS after the rebuild the smart index in the CMS issue still same. Files not synced in the MVC application.

https://ibb.co/fXmkTQF

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 7, 2022 13:01

Are the web farm servers marked as healthy? Keep in mind that the actual smart search index files are not synchronized! There is a web farm task created to notify the web farm servers and each servers builds/updates its own search index files. This means that the files do not have to be 100% identical! Use the LUKE tool and check that you see the updated content in the index or whether the search results contain the new content. If not, then the issue is in the web farm synchronization probably.

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 8, 2022 04:43 (last edited on November 8, 2022 04:45)

Hi @Juraj,

Yes web farm server marked healthy. Yes may be the files not 100 % identical but in my case the file not synced. Attachment of the image https://ibb.co/fXmkTQF.

If I'm using the LUKE tool in to my location system. I need a java environment in my local which not possible. And LUKE tool only show the content of the file.

But in my case if file not synced into the MVC application, so what is the use of LUKE tool.

Last I do these thing in my local to identify the issue. 1. Remove both search folder from the CMS and MVC. 2. Rebuild the Indexes 3. Debug the Web Farm not find anything. 4. Updating the Macro signatures of the application.

Syncing is working pages type indexes and page crawler based indexes only custom type indexes file not synced.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 8, 2022 04:49

As Juraj mentioned the actual smart search index files are not synchronized. They are created MANUALLY in each instance. Do you have your custom index in the MVC app too or just in the CMS? Make sure it's in both

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 8, 2022 04:54 (last edited on November 8, 2022 04:57)

Hi @Brenden,

These step I'm follow for the smart index.

  1. Creating a custom smart index in CMS application.
  2. Same index code assign to the search page.
  3. Rebuild the Smart Index.
  4. After rebuild completed folder created in cms under the name of the index code /App_Data/CMSModules/SmartSearch/<indexname>/
  5. Some of the file synced into the MVC project location /App_Data/CMSModules/SmartSearch/<indexname>/ but some not.

Attached the screen shot https://ibb.co/fXmkTQF

And Web farm automatically synced the search file into the MVC application so why we do manually. And its not feasible to move these file in live server.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 8, 2022 05:30

Pankaj, is the search working on both apps and you are getting desired results? The index files does not have to be identical when it comes to size, name or number of the files. Each app is indexing the content from the DB on its own and creating its OWN set of files. The important thig is whether the index is updated or not - whether it contains the new values or not.

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 8, 2022 05:33

Juraj, search is working fine only in CMS application. Search not working on the MVC reason is behind the *.cfs file not synced/create into the MVC application. If I move manually that file into the MVC application then its working fine.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 8, 2022 05:55

So, then there is some issue with the web farm sync - could you please send screen shots of your web farm settings from the Settings app? Are there any unprocessed tasks in the Web farms app?

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 8, 2022 10:25

@Juraj this is the web farm setting.

https://ibb.co/qyR9J8j

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 8, 2022 12:13

So, the settings look OK. Web farm servers in the Web farms app are marked as healthy and there are no unprocessed tasks on the Tasks tab, right?
Are you able to reproduce the issue on any other instance? Is your app connecting to the right DB? The same as the admin app is connected to?

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 8, 2022 12:38

@Juraj yes Web Farms app are marked as healthy, and there are no unprocessed tasks on the Task tab. Both application connected with the same database.

Please check the screenshot link. https://ibb.co/sgb3t2j

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 9, 2022 09:37

This is really strange. Are you able to reproduce the issue on any other instance? E.g. using the Dancing Goat sample project installation?

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 10, 2022 11:35

@Juraj I'm checked my dev environment on and based of my analysis found that both search result is different means if I'm search the keyword like 'location' in both CMS and MVC result is different in CMS not result return but in the MVC its return some result.

Return content same for all in MVC application, attaching the screen shot.

https://ibb.co/SNr9gVB

Question is why the search is different in both CMS and MVC, the same index is used for both.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 10, 2022 11:39

Well, index is the same but is your MVC app using the same search options, search condition and search mode as the search preview? In your MVC code you could be adding different conditions or mode and this affects the results too. For example you can get different results when using "any word" vs. "exact phrase" vs. "all words" and so on. The search preview is not 100% reliable and does not match your custom MVC code. It is just to check whether there are some data indexed...

0 votesVote for this answer Mark as a Correct answer

pankaj saxena answered on November 10, 2022 12:05

@Juraj in local system both search result is same only that issue on the Dev, Stage & Prod Environment. In both CMS and MVC the parameter is same. Screen shot link attached of the parameter which I passe.

https://ibb.co/Gv0FmKV

0 votesVote for this answer Mark as a Correct answer

Not Applicable answered on February 16, 2023 13:56

We had a similar problem, caused by the <add key="CMSSharedFileSystem" value="true" /> in the web.config. If set to true, Kentico assumes that the local search indexes are on shared storage. It disables the generation of web farm tasks related to synchronization of physical files (media library items, smart search indexes, etc.). See Configuring web farm servers - Web farm instances with a shared file system.

If your storage provider is not configured correctly, the indexes will stay local, there will be no synchronization and no errors in the logging. In your storage initialization module, you have to do something like this:

const string AzureSmartSearchStoragePath = "~/App_Data/CMSModules/SmartSearch";
AbstractStorageProvider smartSearchProvider = StorageProvider.CreateAzureStorageProvider();
smartSearchProvider.PublicExternalFolderObject = true;
StorageHelper.MapStoragePath(AzureSmartSearchStoragePath, smartSearchProvider);
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.