Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

Programmatic content category creation - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
DanatWork
#1 Posted : Saturday, December 7, 2013 11:25:53 AM
Rank: Member

Groups: Registered

Joined: 3/12/2013
Posts: 20
Hi Jim,

I hope you can assist with the issue we are experiencing. We have a custom CMS application. It allows our customers to dynamically create new domains, sub-domains for there websites. When the customer creates a new domain we dynamically create the folders and configuration files (see below). the question is, how can we programmatically create content categories? Mostly this is to separate documents (pdf, doc, docx, etc.) from web pages.

We would like to automatically create content categories called
"Web Pages"
"Documents"

private Configuration CreateConfiguration(string indexRoot, Domain domain, Language language)
{
Configuration conf = new Configuration();
createDirectory(indexRoot, indexRoot + domain.Name.Replace(" ", "_") + @"\" + language.Abbreviation);
ConfigurationManager cm =
new ConfigurationManager(indexRoot + domain.Name.Replace(" ", "_") + @"\" + language.Abbreviation);
cm.RetrieveConfiguration(conf);
conf.MaximumCrawlDepth = MaximumCrawlDepth;
conf.Logging = Logging;
conf.CrawlSubdomains = false;
conf.RespectsRobotsMetaTags = false;
conf.RespectsRobotsTXT = false;

cm.SaveSettings(conf);
return conf;
}

thanks,
-Dan

DanatWork
#2 Posted : Sunday, December 8, 2013 10:12:13 AM
Rank: Member

Groups: Registered

Joined: 3/12/2013
Posts: 20
Hi Jim....Never mind, I think I've got it.... Here's the snippet for anyone else who was wondering:

var conf = getConfiguration(indexDirectoryPath);
//create default content.xml file for content locations
if (!System.IO.File.Exists(indexDirectoryPath + "content.xml"))
{
Keyoti.SearchEngine.Index.DocumentIndex di = new DocumentIndex(conf);
di.Open();

Keyoti.SearchEngine.DataAccess.ContentCategoryRecord ccr =
Keyoti.SearchEngine.DataAccess.ContentCategoryRecord.CreateContentCategoryRecord(
KeyotiVariables.ContentCategory_WebPages);
di.DataAccess.AddContent(ccr);
ccr = Keyoti.SearchEngine.DataAccess.ContentCategoryRecord.CreateContentCategoryRecord(
KeyotiVariables.ContentCategory_Documents);
di.DataAccess.AddContent(ccr);
di.Close();

}

Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.