1

I want to write a query which checks the input provided by the user with the column data of my table. i tried using LIKE and CONTAINS but it didnt work for me. eg my table data contains "Bar B Q Tonight" and if user enters "BBQ Tonight", how to deal with it? I have enabled full text-indexing for my table too. I am working on sql server 2005 in visual studio. can anybody guide me?

MPelletier
  • 16,256
  • 15
  • 86
  • 137
just a learner
  • 57
  • 1
  • 11

2 Answers2

1

One approach to deal with is to create separate column on your table which will contain popular search tags or keywords, based on that you can show the results to the user.

Kapil Khandelwal
  • 15,958
  • 2
  • 45
  • 52
  • i cant do this, as i dnt know what user will search. i need a query to check if substring exists in table data or not – just a learner Mar 22 '13 at 08:06
  • This is a great idea. I just wanted to know if it is better to keep the tags comma separated or store them in a separate table with one-to-many relationship between the current table and tags table. – Rachcha Mar 22 '13 at 08:06
  • I think comma separated tags will be fine. – Kapil Khandelwal Mar 22 '13 at 08:10
  • (It depends on your need) You can have comma separated. Also, if the tags are generic & can apply on multiple columns you can create separate Tags table. – Kapil Khandelwal Mar 22 '13 at 08:16
  • there will be similar acronyms right ? what if BBQ means Be Back Quick? my answer suggest let the user pick the relevance and to facilitate it store multiple acronyms with multiple definitions if exists. – Tony Shih Mar 23 '13 at 00:32
0

Synonyms and acronyms are a challenge for information retrieval systems (IR). Perhaps implement a tiny Acronym Expansion System. Acronyms and expanded terms.

When a user enters such words you need to provide a few suggestions or expanded terms. Like in Google do suggestions or you can show couple of similar terms in return for the query and let the user decide which is relevant.

you need minimum three table as I envisage it but depends on context.

  1. one table contains stop words so you parse each word in the entered phrase and remove all stop words.
  2. then search individual term in acronyms table and if an acronym has more than one definitions you can substitute acronym for each definition and pass it back to user asking which is relevant. if this is web environment it means list of hyperlinks.
Tony Shih
  • 430
  • 5
  • 6