Trouble with LIKEPROWS

Post Reply
tboyer
Posts: 68
Joined: Mon Aug 28, 2006 4:43 pm

Trouble with LIKEPROWS

Post 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
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Trouble with LIKEPROWS

Post by mark »

If you only want a certain number of results from <sql> use the max=# paramater, not likeprows.

<sql max=20 "select ...">
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Trouble with LIKEPROWS

Post 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.
John Turnbull
Thunderstone Software
tboyer
Posts: 68
Joined: Mon Aug 28, 2006 4:43 pm

Trouble with LIKEPROWS

Post 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.
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Trouble with LIKEPROWS

Post by John »

The MAX=20 in the <SQL> statement applies after all processing, it simply stops after 20 results have been returned.
John Turnbull
Thunderstone Software
Post Reply