Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7603931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:46:38+00:00 2026-05-30T23:46:38+00:00

I’m working on a project with SQL Server 2008 where I believe full-text search

  • 0

I’m working on a project with SQL Server 2008 where I believe full-text search is the best way to go. I’ve been reading up on it as much as I can, and pretty much understand hos to set it up for a single table. However I’m not entirely sure how to set it up with my scenario – imagine the following table structure:

Book

- Id
- Title
- Description

BookAuthor

- BookId
- AuthorId

Author

- Id
- Name

As you can see, the database holds a table with books, and each book can have none, one or many authors. Each author can also be part of none, one or many books – i.e. the Book and Author tables have a many-to-many relationship, handled with the linking table BookAuthor.

What I want to accomplish at this point is a search tool to find matching books based on a search string the user provides. So if the user types in Brown I would want to find all books where either of the following columns contains the word Brown:

Book.Title
Book.Description
Author.Name

In essence, I want a result set of books, including both the book with the title Brown Bear and the books written by author Dan Brown. If there are any suggestions out there as to how I should set this up, I’d really appreciate your input!

(as a side note, once I have this filtering working, the query result would also need to be sortable and pageable, handled via @SortOrder, @PageIndex and @PageSize passed into a Stored Procedure – but I guess that could be a separate question afterwards!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:46:39+00:00Added an answer on May 30, 2026 at 11:46 pm

    A CONTAINS predicate can take a list of columns to search as its first argument; however, these columns must be from a single table. You have a couple of options for getting around this limitation. One option is that you can perform two separate searches, one on each table, and then UNION the results together.

    select Id, Title from Book where contains([Description], 'brown')
    union
    select b.Id, b.Title
        from Book b inner join BookAuthor ba on b.Id = ba.BookId
            inner join Author a on a.Id=ba.AuthorId
        where contains([Name], 'brown')
    

    Another option is to take advantage of the fact that FTS indexes can be created on indexed views. To do this, create an indexed view that contains both the Title field from the Book table and the Name field from the Author table, and then create a FTS index on both of these columns in the view. Then you can write queries against this view as follows:

    select BookId, Title from vw_BooksAndAuthors 
    where contains(([Description], [Name]), 'brown')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.