Pagination issue related to pagelinks

Post Reply
Priti Barapatre
Posts: 22
Joined: Fri Oct 19, 2007 10:11 am

Pagination issue related to pagelinks

Post by Priti Barapatre »

Hi John,

We are facing some issue related to pagination that Thuderstone by default provides with pagelinks. When we apply an additional filter to the query like search based on location, it gives me total number of results which are equal to the query matches against the index without applying the location filter. And when we try to paginate though the page numbers, it then resets the total number of results(numrows) now to the query matches and location matches. We are applying the following query. Could you please suggest what should be the possible reason for the same and how we should solve this issue?

"select person_id, last_name, first_name, middle_initial, preferred_name,email, ohr_id, business_name, dialcomm,folders_flag, $$rank rnk from ( last_name\preferred_name\first_name\sc_first_name likep $search_string ) and active_flag=0 and location like $strLocation"

Thanks in advance.
~Priti
User avatar
Kai
Site Admin
Posts: 1271
Joined: Tue Apr 25, 2000 1:27 pm

Pagination issue related to pagelinks

Post by Kai »

<pagelinks> depends on an accurate $indexcount value to compute pagination, and $indexcount is only accurate if a single index was used to fully compute the results. (Presumably there is a `... TableName where ...' clause inserted after your `from'.)

While you can unify the LIKEP and the `active_flag' query with a compound Metamorph index (and un-parenthesizing the query), the `like $strLocation' may not be appropriate for such an index; presumably `location' values might be variable-sized and more than 3-7 characters, correct?

In that case, you can do a count(*) to get the accurate row count, then pass that to <pagelinks> so it can paginate correctly:

<sql "select count(*) TotalNum from ... WHERECLAUSE">
</sql>

<sql row max=10 "select person_id, ... from ... WHERECLAUSE">
... print result as usual ...
</sql>

<!-- Pass in $TotalNum to get accurate pagination: -->
<pagelinks numrows=$TotalNum>

This requires doing the <sql> twice, which is less efficient. If it is possible to make `location' a small fixed-size (e.g. 4 or 8-byte) field, then adding `active_flag' and `location' to a metamorph compound index would make the query fully resolvable by 1 index (assuming no post-processing for the LIKEP user query), and $indexcount would be accurate, and the count(*)/numrows would not be needed.
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Pagination issue related to pagelinks

Post by John »

Assuming you have an index on location the issue should only show up if there are less than maxlinearrows (default 1000) matches for the rest of the query, so you may only need to do the explicit select count(*) if $indexcount is less than 1000.
John Turnbull
Thunderstone Software
Priti Barapatre
Posts: 22
Joined: Fri Oct 19, 2007 10:11 am

Pagination issue related to pagelinks

Post by Priti Barapatre »

Hi Kai,

We tried to implement the compound index like

SQL 1>CREATE METAMORPH INVERTED INDEX xpernames_x_temp on person_profile
SQL 2>( last_name\preferred_name\first_name\sc_first_name,active_flag,location);

But when we try to execute the search on front-end it hangs the browser and throws the following error in vortex.log. And hence we are not able to see if compound index would help us resolving the issue or not. Could you please suggest what's going wrong here?

000 2011-03-07 10:36:13 /webinator/SCPersonSearch:385: Vortex (2897) ABEND: signal 11 (SIGSEGV) at ip 0x1001e01e8
000 2011-03-07 10:42:07 /webinator/SCPersonSearch:385: Vortex (6906) ABEND: signal 11 (SIGSEGV) at ip 0x1001e01e8
000 2011-03-07 10:42:17 /webinator/SCPersonSearch:1717: (7230) Terminated (signal 15)
000 2011-03-07 10:43:18 /webinator/SCPersonSearch:385: Vortex (8205) ABEND: signal 11 (SIGSEGV) at ip 0x1001e01e8

Thanks & Regards,
Priti
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Pagination issue related to pagelinks

Post by mark »

What's on line 385 of SCPersonSearch?
Are there any related messages just before the ABEND?
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Pagination issue related to pagelinks

Post by mark »

Also provide your full texis version printed by
texis -version
Priti Barapatre
Posts: 22
Joined: Fri Oct 19, 2007 10:11 am

Pagination issue related to pagelinks

Post by Priti Barapatre »

At line 385, we have following code, but not sure thats related. But before that we have some function call which actually executes the sql queries.

<if $lstrLayout eq "grid" and $dispFlag eq "true">

We use the following Texis version in our dev environment-

Texis Web Script (Vortex) Copyright (c) 1996-2009 Thunderstone - EPI, Inc.
Commercial Version 5.01.1249359916 20090804 (sparc-sun-solaris2.8-64-64)

Regards,
Priti
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Pagination issue related to pagelinks

Post by mark »

This same script was working before creating the mentioned index? What are the types of all of the
variables involved? last_name, preferred_name, first_name, sc_first_name, active_flag, location, IstrLayout, dispFlag

Can you reproduce the problem in a small script that just does the sql and that if?
Post Reply