Ranking with Dates

Post Reply
paulman
Posts: 40
Joined: Tue Dec 19, 2000 4:08 pm

Ranking with Dates

Post by paulman »

I'm currently using LIKEP for searching several fields. I would also like for the search to take into account a date field. Meaning, records with a more recent date would result in a higher rank value. Is this possible in Texis?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Ranking with Dates

Post by John »

It is possible with Texis. It is useful to have a compound index including the date field, and you would then need to work out the weight you want to give the date, for example you could say:

... ORDER BY $rank + (DateField/86400) desc;

so that every day is worth 1 rank value.
John Turnbull
Thunderstone Software
paulman
Posts: 40
Joined: Tue Dec 19, 2000 4:08 pm

Ranking with Dates

Post by paulman »

My understanding is that setting 'likeprows' to a nonzero number will return the highest ranked records. So if this is set to 50, the SQL statement will return the 50 highest ranked records. Will the above order work in conjunction with 'likeprows'? Or will it take the those 50 highest ranked records and then change the order based on the date?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Ranking with Dates

Post by John »

It will take the 50 highest ranked records, and then reorder those with the ORDER BY.
John Turnbull
Thunderstone Software
dave49
Posts: 2
Joined: Wed Oct 17, 2001 7:47 pm

Ranking with Dates

Post by dave49 »

Regarding...

ORDER BY $rank + (DateField/86400) desc;

Can this be done with the 4.0 Copmmercial Webinator product or is a full Texis license required?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Ranking with Dates

Post by John »

That can be done with either a Webinator or Texis license.
John Turnbull
Thunderstone Software
Josh L
Posts: 12
Joined: Wed May 05, 2004 6:07 pm

Ranking with Dates

Post by Josh L »

I was trying to sort by the date type solely without much luck. Still not sure why, but I did find a solution.

Instead of weighting the date by combining it with $rank, if you convert the date to an number you can successfully order by it. The easiest way to do this, from what I found is

ORDER BY (1 + DateField) desc

Be sure to put the numeral first. (Datefield + 1) will increase the date by one but it will remain as a date type and sorting doesn't work.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Ranking with Dates

Post by mark »

If you don't care about rank use like instead of likep and use a normal "order by DateField".
Post Reply