Page 1 of 1

Best use of likeprows

Posted: Sun Sep 19, 2004 1:02 am
by james120
A common scenario might be that you have 3 things that you want to accomplish to a query:

1) Tell the user how many results there are (even if there are far many total results than are initially being displayed).
2) Display the first X number of results.
3) Allow for the user to see more results from the search in batches of "Y" at a time.

The default for likeprows is 100. That is far too low for my purposes. What is the best way to use likeprows to allow #1 - #3 above? Is it to just set likeprows for the maximum value that #3 will allow the user to get to? Or do something more complicated like always setting likeprows to be equal to the highest number that the user can view on a given page?

Also, can you clarify if likeprows = 100 is returning the FIRST 100 results, or the BEST 100 results? I'm pretty sure it is the best 100 out of all possible matches, but if that is the case, I don't understand why there is a huge (orders of magnitude) difference between this query when run with likeprows=0 (infinite) versus likeprows=5000:

SELECT COUNT(*) from table WHERE field LIKEP '%metalic';

With likeprows=0 set, this query didn't finish in 10 minutes, while it took about 14 seconds with likeprows=5000. This doesn't make sense to me: It must be able to find all the matches relatively quickly, since, assuming my understanding of likeprows is correct, whether likeprows is infinite, 100, or 5000, it has to find all the matching records. And, it has to rank them all in each scenario too, doesn't it? Otherwise it couldn't know what the best "X" hits are. I know it will require a linear scan, so it may be slow, but why the large difference when it seems like most of the hard work is done just to get to the point of determining which the best "X" results are?

By the way, I have tried to use LIKER with this to see if I can avoid post-processing for testing purposes, and the query keeps coming back with 0 hits using LIKER. I don't know why.

Best use of likeprows

Posted: Mon Sep 20, 2004 10:58 am
by John
The most efficient use of likeprows is to set it to the highest numbered result the user will see on that page of results.

The query '%metalic' will not use the index, so it will look linearly until it finds likeprows results. The efficiency of likeprows really comes from queries that can use the index.

Best use of likeprows

Posted: Thu Aug 31, 2006 9:44 pm
by sourceone
As james120 mentioned if likeprows is set to a certain limit, how would the index know if there are more relevant results that have higher rankings beyond that limit or would it know? In other words, it's possible that there are relevant records that could have high ranking beyond the likeprows value?

Best use of likeprows

Posted: Fri Sep 01, 2006 10:01 am
by John
Often the index can tell quickly that the rank would be lower than the threshold to make it into the top likeprows results without doing the full relevance calculation. In addition it does not need to sort those results as they will not be displayed, just the top likeprows results need to be sorted.

Best use of likeprows

Posted: Fri Sep 01, 2006 10:10 am
by sourceone
There are times when I increase likeprows and I see more relevant results that were not at the top of the rank list before I increased likeprows. It seems that some of these more relevant results are not making the top likeprows.

Best use of likeprows

Posted: Fri Sep 01, 2006 10:57 am
by John
That should not happen unless you are customizing the result order and what relevance means. If not please open a tech support ticket with a simple example to reproduce with so we can investigate.