PDA

View Full Version : Range of RELEVANCE in fulltext search?


dff1
04-15-2003, 06:02 PM
Hi all

Does anyone know in what range the relevance can be, when doing a fulltext search?

I would like to calculate a percentage out of the relavancy, and then the relevancy 1.489236 says nothing if I donīt know the largest possible value.

/David - a swedish viking

raf
04-15-2003, 07:16 PM
I would like to calculate a percentage out of the relavancy, and then the relevancy 1.489236 says nothing if I donīt know the largest possible value.

How would you calculate the percentage ? You'de nee to insert the 'ideal record' = more a less the text your matching against and then get the relevancy-value from that and set that as 100%

I don't know the exact searching alghorithme, but i don't think there's a fixed relevancy-maximum. If i'm not mistaken.
"Relevance is computed based on the number of words in the row, the number of unique words in that row, the total number of words in the collection, and the number of documents (rows) that contain a particular word." sais the MySQL site.
So if you would insert just one record with only the searchterms and run a full text search, you'de probably nget the heighest possible value. But this would change as soon as a second record is inserted. So i think that inserting the 'ideal record' is probably the only sollution.

dff1
04-15-2003, 09:24 PM
Actually thatīs a really good solution. Of course Iīll have to perform a second search, which takes some time. But the database isnīt that big, so itīll be ok.

Often the simple solutions are the good ones. I just didnīt think of that one. Thanx!

/David

raf
04-15-2003, 09:40 PM
I'm just that dump i can only think up simple things:D

Iīll have to perform a second search
More like an extra insert. First insert the text you're going to search for, retrieve the id of that record (with mysql_insert_db() or so) then run the matching.
The record you inserted should come out on top, but you can verify that by checking the ID.
Then delete that record again.

It'll probably not the cleanest way, but it'll work.

The closest thing to it is having one dummy record (that remains in the table) and indeed run a second match, but this could take up much more time if you've gor a big table to search.

Is that score really that important (doesn't say anything to me)

dff1
04-16-2003, 08:25 PM
Ok, now I see what you mean. I just did a match against the actual information retrieved, in this case an answer to a question, and calculated the percentage out of that. Turned out ok, but no real hit. Iīll try your way as well.

Honestly, no meaning at all. But I think visitors like results of that kind. But of course I donīt want to have fake values - then Iīll just leave it.

/David