How to return same search results from Search service exactly like Search Core Results web part.

Dec 16, 2014 at 2:30 PM
Hi Marc,

I'm using the Search service with SQL, but I don't get the same results as I do when I search for the same term using regular SharePoint search with the Search Core Results web part. I'm using SP2007.

I'm suspecting the problem is what I'm writing after the WHERE clause. Maybe CONTAINS casts a wide net. Here's my code:
var queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>"
                queryText += "<Query>"
                queryText += "<Range><Count>100</Count></Range>";
                queryText += "<Context>"
                queryText += "<QueryText language='en-US' type='MSSQLFT'>"
                queryText += "SELECT Title, Rank, Size, Description, Write, Path FROM scope() WHERE ((\"SCOPE\" = '"
                queryText += lists[i].listName
                queryText += "')) AND CONTAINS ('"
                queryText += searchText
                queryText += "') ORDER BY \"Rank\" DESC"
                queryText += "</QueryText>"
                queryText += "</Context>"
                queryText += "</Query>"
                queryText += "</QueryPacket>";