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, tá sé ina Hap, skip agus léim ar shiúl a wrap an loighic taobh istigh de pháirt gréasáin nó leathanach iarratais:
ag baint úsáide as Córas; ag baint úsáide as System.Collections.Generic; ag baint úsáide as System.Linq; ag baint úsáide as System.Text; ag baint úsáide as System.Collections.Specialized; ag baint úsáide as Com.FastSearch.Esp.Search; ag baint úsáide as Com.FastSearch.Esp.Search.Http; ag baint úsáide as Com.FastSearch.Esp.Search.Navigation; ag baint úsáide as Com.FastSearch.Esp.Search.Query; ag baint úsáide as Com.FastSearch.Esp.Search.Result; ag baint úsáide as Com.FastSearch.Esp.Search.View; ag baint úsáide as System.Collections; ainmspás Conchango { ranga InvokeSimpleFASTQuery { statach neamhní Príomh-(teaghrán[] comhbhrí leis an rogha) { #réigiún Thúsú ár gcumarsáid le FAST ISearchFactory searchFactory; NameValueCollection nameValueCollection = nua 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 Seoladh ceist teaghrán queryString = "test"; Iarratas cheist = nua Iarratas(queryString); query.SetParameter(BaseParameter.Braisliú, bréagach); query.SetParameter(BaseParameter.NAVIGATION, fíor); query.SetParameter(BaseParameter.NAVIGATION_DEEPHITS, 100); ISearchView searchView; searchView = searchFactory.GetSearchView("sharepointconn"); IQueryResult thoradh air; searchView.Search(cheist); Consól.WriteLine("Total results from search: [" + result.DocCount + "]."); int docCounter = 0; cé go (docCounter < result.DocCount) { docCounter ; IDocumentSummary thisDocSummary = result.GetDocument(docCounter); Consól.WriteLine("[" + docCounter + "]: " + thisDocSummary.GetSummaryField("url").StringValue); } // cé go Consól.ReadLine(); #endregion } } }
Gineann sé an toradh seo a leanas:
</deireadh>
Alvin, figured tú is dócha seo amach cheana féin, ach téann anseo…
Níl a fhios agam an freagra, ach cuimhin liom go raibh mé ag fáil náid tuairimí toisc go raibh rud éigin cearr i dtéarmaí mo config calafoirt freastalaí agus gur saghas rud. Tá sé an-picky.
Fuair ceist mear ar do shon, Paul. Tá mé ag iarraidh a fháil amach conas na tuairimí cuardaigh a chruthú mar a gcoinníonn sé ag filleadh 0 do GetSearchViewList().Líon. An féidir leat pointe dom sa treo ceart?
Go raibh maith agat,
Alvin