Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

programatic ImportWebsite and customData - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
sleslie
#1 Posted : Friday, April 25, 2014 2:14:26 PM
Rank: Member

Groups: Registered

Joined: 4/25/2014
Posts: 2
I am Programmatically adding a website but wish to assign some customData to each of the indexed documents.

eg c# snippet:

Configuration configuration = new Configuration();
configuration.IndexDirectory = @"c:\indexDirectory\";
configuration.MaximumCrawlDepth = 2;

DocumentIndex di = new DocumentIndex(configuration);
di.ImportWebsite("http://www.foobar.com/");

???

Jim
#2 Posted : Friday, April 25, 2014 3:40:59 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Hi, referring to these

http://keyoti.com/produc...20Central%20Events.html

http://keyoti.com/produc...ith%20Custom%20Data.htm

I think this is what you're looking for

Code:

Configuration configuration = new Configuration();
configuration.IndexDirectory = @"c:\indexDirectory\";
configuration.MaximumCrawlDepth = 2;
configuration.CentralEventDispatcher.Action += new
        Keyoti.SearchEngine.Events.ActionEventHandler(CentralEventDispatcher_Action);

DocumentIndex di = new DocumentIndex(configuration);
di.ImportWebsite("http://www.foobar.com/");

...

private void CentralEventDispatcher_Action(object sender, Keyoti.SearchEngine.Events.ActionEventArgs e)

{

    if(e.ActionData.Name== ActionName.ReadText)

    {

        string documentUri = (sender as Document).Uri.AbsoluteUri;

        (e.ActionData.Data as DocumentText).MetaCustomData = "my custom data";


    }

}







-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


sleslie
#3 Posted : Monday, April 28, 2014 10:24:27 AM
Rank: Member

Groups: Registered

Joined: 4/25/2014
Posts: 2
perfect.
works great!
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.