Smarter Search - - how is it done?

Results 1 to 3 of 3

Thread: Smarter Search - - how is it done?

  1. #1
    Jay Seagrave Guest

    Default Smarter Search - - how is it done?

    I have created a simple search that works perfectly for single word searches, so if one searches for "Joe", they get "joe smith" and "joe jones". But if they search for "joe jones", they get no results because the first name and last name are from different columns. Also, if a business name is "joe smith plastics", a query for "joe smith" returns correctly, but a query for "joe plastics" returns nothing. How do i make my search smarter?

  2. #2
    Join Date
    Dec 1969

    Default Depends on the database

    It really depends on the database you're using. If you want to create a smart query in Access, it's going to be pretty complex. If you're using SQL Server, you're in luck. SQL Server has capabilities for full text search and english query.

  3. #3
    Join Date
    Dec 1969

    Default Use a different DB?

    Ah, well...I&#039;ll never convince the world to use Full Text DBs for full text searches, so...<BR><BR>Looking for "Joe Smith" when Joe is in one field and Smith is in another is tough. Unless you are willing to accept a lot of false matches.<BR><BR>Anyway, you need to break up the string into words and then process each word separately. Something like this:<BR><BR>SELECT * FROM table <BR>WHERE<BR>&nbsp; &nbsp; &nbsp; &nbsp; ( firstName LIKE &#039;%Joe%&#039; AND lastName LIKE &#039;%Smith%&#039; )<BR>&nbsp; &nbsp; OR<BR>&nbsp; &nbsp; &nbsp; &nbsp; ( firstName LIKE &#039;%Smith%&#039; AND lastName LIKE &#039;%Joe%&#039; )<BR>&nbsp; &nbsp; OR <BR>&nbsp; &nbsp; &nbsp; &nbsp; ( company LIKE &#039;%Joe%&#039; AND company LIKE &#039;%Smith%&#039; )<BR><BR>If you don&#039;t care about finding anybody named "Smith Joe" then you can omit the second "AND" condition there, of course.<BR><BR>If there are three words input by the user, it just gets longer and more complicated, of course.<BR><BR>I&#039;d *seriously* recommend that you at least make your users specify whether they want to search the name field(s) or the company field or what. But it&#039;s up to you.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts