简体   繁体   中英

Sql server 2008- Full text search across multiple table with '+(and)', '-(and not)' and 'space(or)'

we are implementing Full text search in our project. It is like google search functionality for finding records accros multiple tables. Our database is structure is like we have

Person PersonID FirstName LastName Birthdate

PersonAddress AddressID PersonID Address1 Address2

PersonPhoneNo PhoneID PersonID PhoneNo

Person table has one to many relationship with PersonAddress and PersonPhoneNo. Now our problem is we want search like 'xyz+new york'. And full text search treat this like person xyz staying in new york, or person first name is xyz and last name is new york, or person address is xyz and phone is new york. For this we identify one approach.

For this we have to make compted columns having combination of 'Name+Address1+Address2+PhoneNo'. And have to add this computed column full text search catalog. We made one view using joining of above three column. and add this column of view in full text search catalog.

But again problem is view can not support outer join if we will create full text index on it.

we have come up with this solution: We made one repository table and inserting data using triggering mechanism and make computed columns on that table which combined all the columns. Then we have created full text index on that columns. so this work around is working good for us. Just you need to find appropriate triggering mechanism as per your application and normalized database.

I would use Lucene as a fulltext engine for this. You can easily store several field in one lucene-document, allowing you to do searches like "xyz city:london".

Are you required to use a pure-mssql solution? Try creating indexed views which you apply your fulltext index to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM