Smarter Ordering by number of results

  • I am trying to write a query that searches several varchar fields for a specific term (or a series of terms) and then orders the results by the number of times that term was found in the fields. Does that make sense? For example, if the user searches for "bread recipes", and I look for either of those terms in all three fields, I want to order the results by the frequency of the terms found in all three fields. Is such a thing possible? Did I even explain it well enough?

  • I am not sure, but full-text indexing might be what you are looking for.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Even Full-Text may not be 100% to your request, but it's a start

    You can assign weights to terms/words, but not the columns (which I hate)

    Maybe take a look at this - A Google-like Full Text Search[/url]

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • Thanks for the links. I think you're right in that full-text indexing may not fit the bill exactly. I'm not even sure if the MS Search Service is installed on the server, actually (we don't own this particular server, unfortunately).

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

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