Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fulltext query setup question

Status
Not open for further replies.

brobarn

Programmer
Feb 14, 2004
1
US
Good evening, I'm a little green when it comes to MySQL, so I'm not sure what I need to do to get the results I'm looking for. I'm not sure if it can be done within the query itself, or if I would need to query, then maybe do some post query parsing to get the results.

I have a document library database where I'm searching both the docTitle and docContent fields. Here is the basic query I'm passing through PHP:

$query = "select *, match(docTitle, docContent) against('".$basicSearch."' IN BOOLEAN MODE) as relevance from content where match(docTitle, docContent) against('".$basicSearch."' IN BOOLEAN MODE) order by relevance DESC";

This is a good start for me. However there are one or two documents towards the bottom of the list ranked as a relevance of 1 or 2 where I would like them to be displayed at the top of the results.

What I'm looking for is a way to have these searches weighted to where a document that has any of the words searched for in the docTitle weighted and ranked higher in the results than those documents that have the same words, but are not in the docTitle.

Something else is, there are a few "main" documents in the database, labeled as "MD - (title)" in the docTitle. I would like my MD documents to ALWAYS be at the VERY TOP of the search results page, but then have the rest of the results displayed based on their regular relevance without the user having to type "MD" in their search query.

Are either of these capable by just changing the way I'm querying the database... or is this something I need to do by post processing the array that is returned in PHP?

Any advice?

thanks a million.

-Brock
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top