I want to search blog posts hosted at Hubspot using the smart search. Each blog post has one or more topic IDs such as 4305550016. I created the custom index for it using the following code:
foreach (BlogPost blogPost in blogPosts)
{
// Gets the text content of the blog post
string text = blogPost.post_body;
// Converts the text to lower case
text = text.ToLowerCSafe();
string topicIDs = "";
foreach (object id in blogPost.topic_ids)
{
topicIDs += " ," + id;
}
text += topicIDs;
// Removes diacritics
text = TextHelper.RemoveDiacritics(text);
System.DateTime publishDate = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
publishDate = publishDate.AddMilliseconds(long.Parse(blogPost.publish_date.ToString())).ToLocalTime();
// Creates a new Lucene.Net search document for the current text file
SearchDocumentParameters documentParameters = new SearchDocumentParameters()
{
Index = srchInfo,
Type = SearchHelper.CUSTOM_SEARCH_INDEX,
Id = Guid.NewGuid().ToString(),
Created = publishDate
};
ISearchDocument doc = SearchHelper.CreateDocument(documentParameters);
// Adds a content field. This field is processed when the search looks for matching results.
doc.AddGeneralField(SearchFieldsConstants.CONTENT, text, SearchHelper.StoreContentField, true);
...
iw.AddDocument(doc);
}
The index builds. However, when I search for a topic ID in the search preview on the index maintenance section of Kentico, I don't get any results. I appreciate any suggestions.