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, ito ay isang hop, laktawan at tumalon ang layo sa I-wrap ang logic na ito sa loob ng isang web bahagi o application na pahina:
paggamit Sistema; paggamit System.Collections.Generic; paggamit System.Linq; paggamit System.Text; paggamit System.Collections.Specialized; paggamit Com.FastSearch.Esp.Search; paggamit Com.FastSearch.Esp.Search.Http; paggamit Com.FastSearch.Esp.Search.Navigation; paggamit Com.FastSearch.Esp.Search.Query; paggamit Com.FastSearch.Esp.Search.Result; paggamit Com.FastSearch.Esp.Search.View; paggamit System.Collections; namespace Conchango { klase InvokeSimpleFASTQuery { statik walang bisa Pangunahin(pisi[] args) { #rehiyon Initialize ang aming komunikasyon sa mga FAST ISearchFactory searchFactory; NameValueCollection nameValueCollection = bago 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 Ilunsad ang isang query pisi queryString = "test"; Tanong query = bago Tanong(queryString); query.SetParameter(BaseParameter.CLUSTERING, hindi totoo); query.SetParameter(BaseParameter.NAVIGATION, totoo); query.SetParameter(BaseParameter.NAVIGATION_DEEPHITS, 100); ISearchView searchView; searchView = searchFactory.GetSearchView("sharepointconn"); IQueryResult resulta = searchView.Search(tanong); Mag-aliw.WriteLine("Total results from search: [" + result.DocCount + "]."); int docCounter = 0; habang (docCounter < result.DocCount) { docCounter ; IDocumentSummary thisDocSummary = result.GetDocument(docCounter); Mag-aliw.WriteLine("[" + docCounter + "]: " + thisDocSummary.GetSummaryField("url").StringValue); } // habang Mag-aliw.ReadLine(); #endregion } } }
Ito ay binubuo ng mga sumusunod na resulta:
</dulo>
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.
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().Bilangin. Can you point me in the right direction?
Salamat,
Alvin