Php/ MySql 'Advanced Search' Page

后端 未结 5 2038

I\'m working on an \'advanced search\' page on a site where you would enter a keyword such as \'I like apples\' and it can search the database using the following options:

5条回答
  •  没有蜡笔的小新
    2021-02-04 16:08

    I'm not sure you could easily do those search options in a naive manner as the other two.

    It would be worth your while implementing a better search engine if you need to support those scenarios. A simple one that could probably get you by is something along these lines:

    When an item is added to the database, it is split up into the individual words. At this point "common" words (the, a, etc...) are removed (probably based on a common_words table). The remaining words are added to a words table if they are not already present. There is then a link made between the word entry and the item entry.

    When searching, it is then a case of getting the word ids from the word table and the appropriate lookup of item ids in the joining table.

提交回复
热议问题