DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   Rank mysql search results by coulmn weighting (http://www.daniweb.com/forums/thread199301.html)

tulipputih Jun 23rd, 2009 1:52 pm
Rank mysql search results by coulmn weighting
 
Hello everybody,
how do I rank mysql search results by column weighting?
thanks for your input.

TommyBs Jun 23rd, 2009 1:57 pm
Re: Rank mysql search results by coulmn weighting
 
what do you mean by column weighting?

If you want to choose a preference you just do

SELECT * FROM table ORDER BY column_1, column_2 DESC
changing column_1 etc to whatever field you want to order by. You can order by more then one and you can do descending(DESC) or ascending(ASC) order

tulipputih Jun 23rd, 2009 2:20 pm
Re: Rank mysql search results by coulmn weighting
 
Hi Tommy,
I have several columns in my table 'plan'.
they are ability, noofstudents etc...every column has been weighted according to theirimportance/relevance in planning.
for example: ability: 075
motivation: 0.25
it is not an article search. it is a record search from a table.

thanks in advance.

denit Jun 23rd, 2009 2:37 pm
Re: Rank mysql search results by coulmn weighting
 
please try to ellaborate more on column weighting i cant really understand the exact meaning of the word.

TommyBs Jun 23rd, 2009 5:05 pm
Re: Rank mysql search results by coulmn weighting
 
just do
ORDER BY weight_filter DESC
where weight_filter is the name of the column with that number in

tulipputih Jun 24th, 2009 5:17 pm
Re: Rank mysql search results by coulmn weighting
 
Quote:

Originally Posted by denit (Post 898120)
please try to ellaborate more on column weighting i cant really understand the exact meaning of the word.

Tq..
What I intend to do is..
1. Instead of just list the search result..the percentage of how similar /match the keyword and the record will be displayed..

2. this percentage is based on how important those elements/column..say ability:1, motivation:0.75.

If it is not clear..I will explain in more detail..
MAny thanks


All times are GMT -4. The time now is 2:12 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC