Hit highlighting after a CONTAINS search

  • I have text stored in a text field and full-text indexing enabled. After a search using contains I want to display one of the matching records and highlight the words that match the search criteria within the plain text. How do I find the offsets to the search hits within the text? Is there a way to get a relavancy ranking of the search results? Repeat the same question for RTF stored in an image field assuming I have a IFilter for RTF installed. TIA

  • I assume you want to display the results of your search in asp pages via browser.

    Try using the replace function like

    replace(<your_textfield>,<search_string>,<font="<your_color>">&search_string & </font>,1,,vbBinaryCompare)

    Maybe you have to put <font="<your_color>">&search_string & </font> in a variable.

    If you're search contains more than one words, you have to loop through them and replace.

    HTH

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Hello

    I have in my sql 2005 table a varchar(max) column in which I'm saving word documents and even pdf documents

    when searching for some words inside the documents I want to display the entire document content highlighting the matches or hits

    is there a way to this?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply