IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
Sitefinity CMS can index data items that are managed on external systems. For example, if you have blog posts, which are managed on an external system, by retrieving values of the posts' data fields, adding them to a search document, and updating Sitefinty's index, the blog posts are indexed in Sitefinity.
The data content that you want to index must be compatible with Sitefinity CMS Search. This means that the fields that you want to participate in the index must be of type string, int, or DateTime.
To index external content in Sitefinity's indexes, you must create a search document for each indexed item and push it into the current Search Service implementation. When search documents are indexed, they are displayed in search results and search suggestions in Sitefinity.
The following code demonstrates a creation of a search document, populated with a number fields, which is pushed into Sitefinity CMS index:
/// <summary>
/// Creates a new document and adds it to the search index.
/// </summary>
public
void
AddSearchDocument()
{
var fields =
new
List<IField>();
// The identity field
var identityFld =
Field();
identityFld.Name =
"IdentityField"
;
identityFld.Value =
"some unique identifier"
// Use lowercase only
fields.Add(identityFld);
var myTitleField =
myTitleField.Name =
"Title"
myTitleField.Value =
"Here goes the title"
fields.Add(myTitleField);
var lastModifiedField =
lastModifiedField.Name =
"LastModified"
lastModifiedField.Value = DateTime.UtcNow;
fields.Add(lastModifiedField);
// Create the document, containing the fields that we constructed
var doc =
Document(fields,
);
// index the created document
ServiceBus.ResolveService<ISearchService>().UpdateIndex(
"index"
,
List<IDocument>() { doc });
}
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important