I have a custom ISearchableContentType
I'm wondering once I create new content of that type, how long will it take before it shows up in the search index?
I have a custom ISearchableContentType
I'm wondering once I create new content of that type, how long will it take before it shows up in the search index?
I have verified my content is in the Solr index, but it is not returned as a search result in the site. Do I need to specify content types?


public IList<SearchIndexDocument> GetContentToIndex()
{
List<SearchIndexDocument> documents = new List<SearchIndexDocument>();
var pages = Components.CMSPages.ListPages();
foreach (var page in pages)
{
if (page.IsPublished)
{
SearchIndexDocument doc = new SearchIndexDocument
{
Content = page.ContentBlob,
Title = page.MetaTitle,
ContentId = page.ContentId,
ContentTypeId = Components.CMSPages.CMS_PAGE_CONTENT_TYPE_ID,
Id = page.Id.ToString(),
TypeName = "HFCMSPAGE",
Url = page.Url,
};
documents.Add(doc);
}
}
return documents;
}Did you provides roles for ISearchableContentType.GetViewSecurityRoles()? Minimally Everyone role. Not doing this will definitely make it not come back. I would say also add a date and category to participate in any faceting. Can you post a document (xml) from Solr here (or PM). I can try to load it up.
Yes. I can see my custom content type showing up in the facets, but no results yet.
<doc>
<str name="content">Luke CMS Page is a great page where you can do Klokov press and other types of squats and olympic lifts.</str>
<str name="rawcontent">Luke CMS Page is a great page where you can do Klokov press and other types of squats and olympic lifts.</str>
<str name="title">Luke CMS Page</str>
<str name="contenttypeid">2da07dc7-f5f3-4f6f-8766-218a0153714e</str>
<str name="id">2</str>
<str name="type">WebContent</str>
<str name="url">/luke-cms-page</str>
<arr name="category">
<str>WebContent</str>
</arr>
<long name="_version_">1660270192257662976</long>
<bool name="isapplication">false</bool>
<bool name="iscontainer">false</bool>
<double name="contentscore">0.0</double>
<date name="timestamp">2020-03-04T21:24:00.651Z</date>
<float name="score">13.498373</float></doc> public Guid[] ApplicationTypes
{
get { return new Guid[] { Apis.Get<IGroups>().ApplicationTypeId }; }
}
public Guid ContentTypeId
{
get
{
return Components.CMSPages.CMS_PAGE_CONTENT_TYPE_ID;
}
}
public string ContentTypeName
{
get
{
return "CMS Page";
}
}
public string Description
{
get
{
return "Content type for custom CMS pages";
}
}
public string Name
{
get
{
return "Hearing First - CMS Page Content Type";
}
}
public bool IsCacheable => true;
public bool VaryCacheByUser => false;
public void AttachChangeEvents(IContentStateChanges stateChanges)
{
}
public IContent Get(Guid contentId)
{
return Components.CMSPages.Get(contentId);
}
public IList<SearchIndexDocument> GetContentToIndex()
{
List<SearchIndexDocument> documents = new List<SearchIndexDocument>();
var pages = Components.CMSPages.ListPages();
foreach (var page in pages)
{
if (page.IsPublished)
{
SearchIndexDocument doc = new SearchIndexDocument
{
Content = page.ContentBlob,
Title = page.MetaTitle,
ContentId = page.ContentId,
ContentTypeId = Components.CMSPages.CMS_PAGE_CONTENT_TYPE_ID,
Id = page.Id.ToString(),
TypeName = "WebContent",
Url = page.Url,
};
documents.Add(doc);
}
}
return documents;
}
public string GetViewHtml(IContent content, Target target)
{
var page = Components.CMSPages.Get(content.ContentId);
return page.MetaDescription;
}
public int[] GetViewSecurityRoles(Guid contentId)
{
List<int> roleIds = new List<int>();
// Add the Everyone Role
roleIds.Add(1);
return roleIds.ToArray();
}
public void Initialize()
{
}Havent tried yet but can I assume the last missing element is roles?
I did add the Everyone Role...and still didn't show
However, in the document that is in Solr, I'm not seeing them...When I search for a piece of Telligent content I see this
<arr name="roles"> <str>3</str> <str>4</str> <str>14</str> <str>15</str> <str>16</str> <str>81</str> <str>95</str> </arr>
Added this to my Class as well
public int[] GetViewSecurityRoles(Guid contentId)
{
List<int> roleIds = new List<int>();
// Add the Everyone Role
roleIds.Add(1);
return roleIds.ToArray();
}Set the Id = ContentId. When adding the roles its looking up by Id vs ContentId.