Paul Galvin's (old) SharePoint space [SharePoint

Just another WordPress.com site

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: