Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Sharepoint 2013 and FullTextSQLQuery

$
0
0

Hi,

In previous versions of SharePoint (2007 and 2010), we have used FullTextSqlQuery class, which has now been deprecated. What is the right alternative in 2013 version? 

I Used  following code from here

public static DataTable ExecuteKeywordQuery(string query) 

    DataTable retResults = new DataTable(); 
    ClientContext con = new ClientContext("http://basesmc15"); 
    KeywordQuery kq = new KeywordQuery(con); 

    kq.QueryText = query; 
    kq.SelectProperties.Add("testcol"); 

    SearchExecutor se = new SearchExecutor(con); 
    var results = se.ExecuteQuery(kq); 

    con.Load(kq); 
    con.Load(se); 
    con.ExecuteQuery(); 

    var result = from r in results.Value where r.TableType == KnownTableTypes.RelevantResults select r; 

    if (result != null) 
    { 
        //get column names 
        foreach (var col in result.First().ResultRows.First()) 
        { 
            retResults.Columns.Add(col.Key.ToString(), col.Value != null ? col.Value.GetType() : typeof(object)); 
        } 

        foreach (var row in result.First().ResultRows) 
        { 
            retResults.LoadDataRow(row.Values.ToArray(), LoadOption.Upsert); 

        } 

        retResults.AcceptChanges(); 

    } 

    return retResults; 

}

How do i use EnableFQL property here because in above code, "KeywordQuery"is object of type "Microsoft.SharePoint.Client.Search.Query" while, EnableFQL property of object of type "Microsoft.Office.Server.Search.Query"only. 

Thanks in advance,

Avni.Bhatt



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>