How to use kyewordsearch query in c# to implement the Search object. What settings need through Central administration to enable kyewordsearch query ?
Also please send me Syntax for KeywordQuery.QueryText. means how to write query ?
How to use kyewordsearch query in c# to implement the Search object. What settings need through Central administration to enable kyewordsearch query ?
Also please send me Syntax for KeywordQuery.QueryText. means how to write query ?
Take a look at http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/02/19/how-to-use-the-moss-enterprise-search-keywordquery-class.aspx
Lalit,
Have a look at this in msdn. You will all information you need there.
http://msdn.microsoft.com/en-us/library/ms544561%28office.12%29.aspx
Also, in the same page, have a look at which scenarios suit Keyword query(simple queries with keyword syntax, this will not required constructing a complete query but only keywords will suffice) and scenarios that suit FullText query( if you need complex queries to be executed which include query elements like Contains, Like, OrderBy etc which is not possible using Keyword query syntax).
As a simple example:
ServerContext context = ServerContext.GetContext(HttpContext.Current);
using (KeywordQuery keywordQuery = new KeywordQuery(context))
{
keywordQuery.ResultTypes = ResultType.RelevantResults;
keywordQuery.EnableStemming = true;
keywordQuery.TrimDuplicates = true;
keywordQuery.StartRow = 0;
keywordQuery.SortList.Add(filterField, SortDirection.Ascending);
keywordQuery.QueryText = string.Format(CultureInfo.InvariantCulture, "scope:\"{0}\"", "people");
keywordQuery.SelectProperties.Add("FirstName");
ResultTableCollection resultsCollection = keywordQuery.Execute();
ResultTable resultsTable = resultsCollection[ResultType.RelevantResults];}
You can specify Select properties in KeywordQuery.SelectProperties and add filter conditions like scope in query text.
In central admin, i think you just need to ensure that your content source is crawled and you can start executing your keyword or fulltext queries.
Hope this helps.