2

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
            };

1 Answer 1

1

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
            };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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