Knowledgebase Home Page  >  SearchUnit  >  Version 2 Articles
Search the Knowledge Base
How can I index files contained in my own custom storage? (C#)
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=71&catId=66

Options

Print this page
Email this to a friend
Please download this example
 
 
The example demonstrates how you can override our 'reader' code, so that the search engine will use your own class to read documents.  The code in the example is highly simplified, the custom reader does nothing more than return the document as a file stream, however this should be all you need to begin writing your own reader.
 
Before you can run it fully you will need a trial license key, and it should be inserted inplace of "<<insert trial license key here>>" which appears in Form1.cs.  The following key will work until June 26th 2005:
5550655C6258645D665768675F5864365151393B363C4039433B41404147404B4B484A4
(trial keys can also be obtained from support@keyoti.com)
 
The example works by subclassing our DocumentIndex class, usually this class builds the index so that searches can be made - here we have subclassed it and overridden the CreateNewDocument method, so that we can set the Reader property for each document.  The Reader property specifies the class that reads documents.  In our code we have set Reader to an instance of CustomReader.  CustomReader.GetStream is where we have written custom code to access documents, the method is parsed a URI of the document and we then access the document and return it as a stream.
 
The Form also has a search button, which proves that the documents have been indexed by running a search for a preset word, the search results are shown in the list box as URIs
 
Once the index files have been created, they can then be used with the search web controls, just by placing them in the IndexDirectory (as per the property in the SearchResult control).
 
We will be pleased to assist further, please email support@keyoti.com or post a message on our forums if you have any questions.

Related Questions:

Attachments:

No attachments were found.