New search feature

PythonPython Forum LeaderThe Royal RAM
Woohoo finished my first ever search script.... http://www.devdreams.com/search.php

Seems to be working quite nicely aswell :)

Is there anyway I can order the results by how relevant they are or is that automatic?

The Royal Ram

Comments

  • NuvoNuvo Forum Leader VPS - Virtual Prince of the Server
    Well, depending on how you coded it, the results should be listed accoring to the "ORDER BY" bit of your mySQL query unless you're going for something more complex such searching for individual words and the whole search term (so "I have a hat" would look for "I", "have", "a", "hat" and "I have a hat" but only).
    By looking for idividual words, it'd be possible to create search results which list items with more instances of the words in the seach string, but you'd need to know how many instances of a word are present in a body of text.
    If you have a field in your table to show how many times people have clicked the links to your articles, you could also list by that (popularity).
    Your best bet would be to look up search algorythms in php on google or something...
    PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
    Current project: CMS Object.
    Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
    Release date: NEVER!!!
  • ChroderChroder Senior Member The Royal RAM
    If you use fulltext searching (which is what you should be using), then results are returned in order of relevancy.
  • PythonPython Forum Leader The Royal RAM
    the basic syntax of what im uisng is:

    if `tablename` LIKE %keywords% then dsiplay results...

    how would that be changed for relevancy ordering...

    The Royal Ram

Sign In or Register to comment.