blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Paul Galvin's Blog

FAST SharePoint Integration: Sample Code to Display All Available FAST Views

 

Here is some code that shows all available views from a FAST server based on the named QRServer (the server process with which we communicate).  I offer this up to give you all a taste of what it's like to use the provided FAST API.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.FastSearch.Esp.Search;
using Com.FastSearch.Esp.Search.Http;
using Com.FastSearch.Esp.Search.Navigation;
using Com.FastSearch.Esp.Search.Query;
using Com.FastSearch.Esp.Search.Result;
using Com.FastSearch.Esp.Search.View;
using System.Collections.Specialized;
using System.Collections;


namespace Conchango
{
    class EnumerateFASTViews
    {
        static void Main(string[] args)
        {

            ISearchFactory searchFactory;

            NameValueCollection nameValueCollection = new NameValueCollection();

            nameValueCollection.Add("fastsearchengine", "Com.FastSearch.Esp.Search.Http.HttpSearchFactory");
            nameValueCollection.Add("Com.FastSearch.Esp.Search.Http.QRServers", "fastdemoback:15100");
            nameValueCollection.Add("Com.FastSearch.Esp.Search.Http.RequestMethod", "GET");

            searchFactory = SearchFactory.NewInstance(nameValueCollection);

            Console.WriteLine("Total Views: [" + searchFactory.GetSearchViewList().Count + "].");

            int i = 0;

            foreach (object o in searchFactory.GetSearchViewList())
            {
                Console.WriteLine("View [" + i++ + "]: [" + o.ToString() + "].");

            }
            
            Console.ReadLine();
            
        }
    }
}

 

Note that I consider myself a barely competent C# programmer and I have thin skin, so don't send any raspberries my way, especially re: the "foreach (object o in ...)" construct :)

</end>

Technorati Tags: ,

Subscribe to my blog.

Published 07 April 2008 19:13 by paul.galvin
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems