Question

I'm working on creating a 100% custom search page, and I'm using FullTextSqlQuery to query my site to find what I'm looking for. My query works fine but what I need is a way to show the user a small highlighted part of the page where that text was found. (Just like how Google or SharePoint search shows you a paragraph of where that text was found.)

If there is no way to be able to do that, how can I change my query so I get the entire site information so I can parse it my self and get that formation.

            FullTextSqlQuery myQuery = new FullTextSqlQuery(site)
            {
                QueryText = String.Format("SELECT Title, Path, Description, Write, Rank, Size, ContentType, Author FROM Scope() WHERE CONTAINS('{0}')", tag),
                ResultTypes = ResultType.RelevantResults,
                RowLimit = 2000
            };
Was it helpful?

Solution

Figured out the issue

The right FullTextSqlQuery is

            FullTextSqlQuery myQuery = new FullTextSqlQuery(site)
            {
                QueryText = String.Format("SELECT Title, Path, Description, Write, Rank, Size, ContentType, Author, HitHighlightedSummary, HitHighlightedProperties FROM Scope() WHERE CONTAINS('{0}')", tag),
                HighlightedSentenceCount = 2,
                ResultTypes = ResultType.RelevantResults,
                RowLimit = 2000
            };
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top