Search Engine Logic?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhappy
    New Member
    • Jul 2007
    • 139

    Search Engine Logic?

    Hi All,

    I am doing search engine in my home page. It will search all products details for a specified pattren/search keyword in all categories. It should display the first product as the most character match of key words which the user has entered for the Products. Any idea plz............ ..........

    My logic is prod_name like '%mobile%'

    Thanks.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Well I'm not sure what a search engine has to do with it, your %string% seems like a workable enough solution. Just find a way to format the results into something that looks nice?

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Suppose you are searching for two words " scripts byte" from a column in a table which has two rows with
      Code:
      row1 "the scripts byte"
      row2 "the byte"
      If you take the search string entered and break it up into an array and then do
      Code:
       for(int i=0;i < array.Length;i++) {
      					select rowID from tableName where
      					 upper(colName) like upper('%array[i]%')
      					 add rowID to an ArrayList called IDs here
      }
      After all this the IDs ArrayList can easily tell you which row had the most hits.


      Note:
      • This technique is a brute force one and is probably the slowest.
      • Getting results from a database inside a for loop requires motherly care.

      Comment

      Working...