Page 1 of 1

Trouble with LIKEPROWS

Posted: Mon Nov 07, 2011 11:22 am
by tboyer
I'm having trouble getting a query to obey LIKEPROWS.

<sql "SET likeprows = 20;"></sql>
<sql "select id from table where flag='0' and textfield likep $pterms "></sql>

I'm finding that LIKEPROWS will not operate when the WHERE includes the flag field -- btree index. I get 8000 results even with LIKEPROWS set to 20. Is there a way to get around this?

Thanks,

Tom

Trouble with LIKEPROWS

Posted: Mon Nov 07, 2011 11:47 am
by mark
If you only want a certain number of results from <sql> use the max=# paramater, not likeprows.

<sql max=20 "select ...">

Trouble with LIKEPROWS

Posted: Mon Nov 07, 2011 12:26 pm
by John
With other conditions in play Texis may need to look at more rows to make sure you get some results out, so LIKEPROWS may not be able to limit the results. Depending on what you are trying to do creating appropriate indexes, and changing the order of the where clause can help.

Trouble with LIKEPROWS

Posted: Mon Nov 07, 2011 12:26 pm
by tboyer
Mark,

I have allmatch turned off. If the likep is going to return 10,000 bills and I have max=20, is it giving me the best 20 matches or is it cutting off processing before it fully evaluates and ranks the 10,000? In that case it would be better for me to keep the 10,000 in the set.

Trouble with LIKEPROWS

Posted: Mon Nov 07, 2011 12:48 pm
by John
The MAX=20 in the <SQL> statement applies after all processing, it simply stops after 20 results have been returned.