Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
            };
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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
            };
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.