Automatic update index of Smart search when create document by using API

Justin TR asked on June 24, 2015 12:28

Hi,

I created a new document by using API, and created Smart search index with type = pages to get indexes of document.

I tried to use 2 ways for inserting document to Kentico tree.

Method 1: DocumentHelper.InsertDocument(newNode, parentNode, treeProvider);

Method 2: newNode.Insert(parentNode);

This node inserted to Kentico tree successful, but Indexed items number of Smart search didn't update.

In Event log, I saw an error of Smart search index:

Event ID: 69881
Event type: Error
Event time: 6/24/2015 4:42:48 PM
Source: Smart search
Event code: PROCESSSEARCHTASK
User ID: 65
User name: public
IP address:
Description:
Message: Object reference not set to an instance of an object.

Exception type: System.NullReferenceException
Stack Trace: 
at CMS.Search.SearchTaskInfoProvider.TaskIndexer()
at CMS.Search.SearchTaskInfoProvider.RunInternal()   

Did I do anything wrong, or I need to code something to make the Smart search index work for this case.

Thanks,

Recent Answers


Roman Koníček answered on June 28, 2015 21:36

Hi Justin,

Method 2 - newNode.Insert(parentNode) is working fine on my end. Could you please tell me what version of Kentico are you using? Have you applied any hotfixes?

Also if you create a new document via user interface rather then using API, does it work properly?

Best regards, Roman Konicek

0 votesVote for this answer Mark as a Correct answer

Justin TR answered on June 29, 2015 11:11 (last edited on June 29, 2015 11:12)

Hi,

I'm using the latest version of Kentico - 8.2, and applied the latest hotfix - 8.2.26.

It works properly when I create a new document via user interface.

Thanks

0 votesVote for this answer Mark as a Correct answer

Roman Koníček answered on June 29, 2015 14:44

Hi Justin,

I was in touch with development team and found out that you are supposed to use InsertDocument method. If you use this method Staging and search indexing tasks should be generated automatically.

At this point we need to know if the search tasks is created or not. Could you please check it in Smart search application -> Tasks tab? Is the task created when you use the InsertDocument method?

Best regards, Roman Konicek

0 votesVote for this answer Mark as a Correct answer

Justin TR answered on June 30, 2015 06:28

Hi Roman,

I'm using InsertDocument method. Tasks are created when I created a new document. But the result of it is Fail. I took 2 pics for this problem below.

Image Text

Image Text

Thanks, Justin

0 votesVote for this answer Mark as a Correct answer

Roman Koníček answered on June 30, 2015 20:29

Hi Justin,

I am not able to reproduce the issue on my end. Could you please provide a background? Where are you trying to call InsertDocument method? For example is that your custom web part? Could you please provide the code? If you do not want to share the code on Q&A, feel free to send an email to support@kentico.com and in the subject put "attention Roman".

Thanks and regards, Roman Konicek

0 votesVote for this answer Mark as a Correct answer

Justin TR answered on July 1, 2015 09:45

Hi Roman,

I have just sent an email to support@kentico.com. Could you help me to check it?

Thanks, Justin

0 votesVote for this answer Mark as a Correct answer

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