FAST SharePoint Sameining: Keyra einfalda fyrirspurn

This is a continuation in my FAST coding mini-series for SharePoint folk. The bit of code below executes a search for the term "test" in FAST via a Console application. Obviously, það er step, sleppa og stökkva í burtu til að vefja þessa rökfræði inni á vefnum hluta eða umsókn síðu:

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

namespace Conchango
{
    flokki InvokeSimpleFASTQuery
    {
        truflanir ógilt Main(band[] args)
        {

            #region Initialize our communication with FAST
            ISearchFactory searchFactory;

            NameValueCollection nameValueCollection =  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);

            #endregion

            #region Launch a query

            band queryString = "test";

            Fyrirspurn query =  Fyrirspurn(queryString);

            query.SetParameter(BaseParameter.CLUSTERING, ósatt);
            query.SetParameter(BaseParameter.NAVIGATION, satt);
            query.SetParameter(BaseParameter.NAVIGATION_DEEPHITS, 100);

            ISearchView searchView;
            searchView = searchFactory.GetSearchView("sharepointconn");

            IQueryResult result = searchView.Search(query);

            Console.WriteLine("Total results from search: [" + result.DocCount + "].");

            INT docCounter = 0;

            while (docCounter < result.DocCount)
            {

                docCounter  ;

                IDocumentSummary thisDocSummary = result.GetDocument(docCounter);

                Console.WriteLine("[" + docCounter + "]: " + thisDocSummary.GetSummaryField("url").StringValue);

            } // while

            Console.ReadLine();
            #endregion

        }
    }
}

It generates the following result:

mynd

</enda>

Gerast áskrifandi að bloggið mitt.

Technorati Tags: ,

2 hugsanir á "FAST SharePoint Sameining: Keyra einfalda fyrirspurn

  1. Paul Galvin

    Alvin, you probably figured this out already, but here goes…

    I don’t know the answer, but I recall that I was getting zero views because something was wrong in terms of my server port config and that sort of thing. It’s very picky.

    Svara
  2. Alvin

    Got a quick question for you, Paul. I’ve been trying to find out how to create these search views as it keeps returning 0 for GetSearchViewList().Count. Can you point me in the right direction?

    Takk,
    Alvin

    Svara

Eftir svar

Netfangið þitt verður ekki birt. Nauðsynlegir reitir eru merktir *