Numerically sorting a new Zebra Index
Hello, Running Koha 3.06 on Centos 5.5. I want to add a new item attribute, canumber to the Zebra Index. It should be visible on the staff client. All values are numbers ranging from 1 to around 15000000. I have done the following steps: 1. In bib1.att att 8032 canumber 2. In the marc21 record.abs melm 952$z canumber, canumber:n, item 3. In ccl.properties canumber 1=8032 Zebra has been reindexed. I want to use the canumber in place of acq-date in the Bulk label barcode generation. In label-item-search.pl under intranet/cgi-bin/labels . I am performing a search using the following limits : "canumber,ge="<textbox data> and "canumber,le="<textbox data>. The search actually works and returns results but the results seem to be sorted as text. ie searching beween 1000 and 1010 returns items with canumber 1000000 etc. As a test I changed the attribute of itemnotes in items table from varchar to int(11) in a test machine and reran the index. Still not getting proper numeric sorting. The Zebra docs mention that lexicographic sorting is default and numeric sorting has to be enabled. As I understood it is defined in the record.abs. How can I change the mappings in record.abs to get numerically sorted results ? Is the query I am using in label-item-search.pl correct ? Regards, Senthil
Hie, Have a look at @att 7 of Zebra : http://www.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-at... It introduces sorting into query. In ccl.properties you find ascending and descending sort : *sort1 7=1 sort2 7=2* So your ccl query looks like : *"(canumber,ge=1000 and "canumber,le=2000) or sort1,canumber=0"* *PS : * You must add the sort structure (:s) into "record.abs" : melm 952$z canumber, canumber:n, canumber:s, item Regards, On Thu, Dec 16, 2010 at 3:21 PM, Senthil Anand <ssenthilanand@gmail.com>wrote:
Hello,
Running Koha 3.06 on Centos 5.5.
I want to add a new item attribute, canumber to the Zebra Index. It should be visible on the staff client. All values are numbers ranging from 1 to around 15000000.
I have done the following steps:
1. In bib1.att
att 8032 canumber
2. In the marc21 record.abs
melm 952$z canumber, canumber:n, item
3. In ccl.properties
canumber 1=8032
Zebra has been reindexed.
I want to use the canumber in place of acq-date in the Bulk label barcode generation.
In label-item-search.pl under intranet/cgi-bin/labels . I am performing a search using the following limits :
"canumber,ge="<textbox data> and
"canumber,le="<textbox data>.
The search actually works and returns results but the results seem to be sorted as text. ie searching beween 1000 and 1010 returns items with canumber 1000000 etc. As a test I changed the attribute of itemnotes in items table from varchar to int(11) in a test machine and reran the index. Still not getting proper numeric sorting.
The Zebra docs mention that lexicographic sorting is default and numeric sorting has to be enabled. As I understood it is defined in the record.abs. How can I change the mappings in record.abs to get numerically sorted results ? Is the query I am using in label-item-search.pl correct ?
Regards, Senthil _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- Fridolyn SOMERS ICT engineer PROGILONE - Lyon - France fridolyn.somers@gmail.com
Le 17/12/2010 14:40, Fridolyn SOMERS a écrit :
Hie,
Have a look at @att 7 of Zebra : http://www.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-at...
It introduces sorting into query.
In ccl.properties you find ascending and descending sort : /sort1 7=1 sort2 7=2/
So your ccl query looks like : /"(canumber,ge=1000 and "canumber,le=2000) or sort1,canumber=0"/
*_PS : _* You must add the sort structure (:s) into "record.abs" :
melm 952$z canumber, canumber:n, canumber:s, item
Regards,
Fridolyn, what you said is helpfull but not really fixes the problem... It appears that it lies in @attr 4=109 that should be used and not @attr 4=1 or @attr 4=6... That is to say Senthil has to tell on what TYPE of data he is trying to sort. Sorting on number is not the same as sorting alphabetical things. so in pqf it would be @or your query @attr 1=canumber @attr 7=1 @attr 4=109 1 in ccl yourquery or canumber,sort1,st-numeric=1 or edit the code so that it sends the correct queries. Hopes that helps... -- Henri-Damien LAURENT
You are right, I missed the @att type 4. Then, it should also be set on query. *I found another error *: le and ge souldn't come with "=" : use ">=" ans "<=". * *It gives :* "(canumber,st-numeric**>=1000 and canumber**,st-numeric<**=2000) or sort1,canumber**,st-numeric**=0".* *PS : * The zero in *sort1**(...)=0* means that this sort in the first (in case there is a second sort, sort=1, etc). If it doesn't work, send us the PQF(... @att ...) query from Zebra logs. Regards, On Fri, Dec 17, 2010 at 4:48 PM, LAURENT Henri-Damien < henridamien.laurent@gmail.com> wrote:
Le 17/12/2010 14:40, Fridolyn SOMERS a écrit :
Hie,
Have a look at @att 7 of Zebra :
http://www.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-at...
It introduces sorting into query.
In ccl.properties you find ascending and descending sort : /sort1 7=1 sort2 7=2/
So your ccl query looks like : /"(canumber,ge=1000 and "canumber,le=2000) or sort1,canumber=0"/
*_PS : _* You must add the sort structure (:s) into "record.abs" :
melm 952$z canumber, canumber:n, canumber:s, item
Regards,
Fridolyn, what you said is helpfull but not really fixes the problem... It appears that it lies in @attr 4=109 that should be used and not @attr 4=1 or @attr 4=6... That is to say Senthil has to tell on what TYPE of data he is trying to sort. Sorting on number is not the same as sorting alphabetical things. so in pqf it would be @or your query @attr 1=canumber @attr 7=1 @attr 4=109 1 in ccl yourquery or canumber,sort1,st-numeric=1 or edit the code so that it sends the correct queries. Hopes that helps...
-- Henri-Damien LAURENT _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- Fridolyn SOMERS ICT engineer PROGILONE - Lyon - France fridolyn.somers@gmail.com
Hello, I am basically sorting pure numbers from a varchar field. After changing the record.abs to melm 952$z canumber,canumber:n,canumber:s,item and using the query canumber,st-numeric>=<textbox value> and canumber,st-numeric<=<textbox value> with values 3 and 100 I get 11 items. mysql> select itemnotes from items where (itemnotes + 0) >= 3 and (itemnotes + 0) <= 100; ... 11 rows in set (1.16 sec) The corresponding barcodes are also identical in both cases. So it seems to work on my small test install in my netbook. Will check it in a larger test system with more varied canumber values in a few days and report back then. The whole Zebra search syntax seems completely alien to me after being used to SQL. Thanks for the tips. Regards, Senthil 2010/12/17 Fridolyn SOMERS <fridolyn.somers@gmail.com>:
You are right,
I missed the @att type 4. Then, it should also be set on query.
I found another error : le and ge souldn't come with "=" : use ">=" ans "<=".
It gives :
"(canumber,st-numeric>=1000 and canumber,st-numeric<=2000) or sort1,canumber,st-numeric=0".
PS : The zero in sort1(...)=0 means that this sort in the first (in case there is a second sort, sort=1, etc).
If it doesn't work, send us the PQF(... @att ...) query from Zebra logs.
Regards,
On Fri, Dec 17, 2010 at 4:48 PM, LAURENT Henri-Damien <henridamien.laurent@gmail.com> wrote:
Le 17/12/2010 14:40, Fridolyn SOMERS a écrit :
Hie,
Have a look at @att 7 of Zebra :
http://www.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-at...
It introduces sorting into query.
In ccl.properties you find ascending and descending sort : /sort1 7=1 sort2 7=2/
So your ccl query looks like : /"(canumber,ge=1000 and "canumber,le=2000) or sort1,canumber=0"/
*_PS : _* You must add the sort structure (:s) into "record.abs" :
melm 952$z canumber, canumber:n, canumber:s, item
Regards,
Fridolyn, what you said is helpfull but not really fixes the problem... It appears that it lies in @attr 4=109 that should be used and not @attr 4=1 or @attr 4=6... That is to say Senthil has to tell on what TYPE of data he is trying to sort. Sorting on number is not the same as sorting alphabetical things. so in pqf it would be @or your query @attr 1=canumber @attr 7=1 @attr 4=109 1 in ccl yourquery or canumber,sort1,st-numeric=1 or edit the code so that it sends the correct queries. Hopes that helps...
Your welcome, The whole Zebra search syntax seems completely alien to me
It was the same for me. But with the only doc online (www.indexdata.com), I descovered a powerfull search engine. Good luke, Regards, On Sat, Dec 18, 2010 at 6:41 PM, Senthil Anand <ssenthilanand@gmail.com>wrote:
Hello,
I am basically sorting pure numbers from a varchar field.
After changing the record.abs to melm 952$z canumber,canumber:n,canumber:s,item
and using the query canumber,st-numeric>=<textbox value> and canumber,st-numeric<=<textbox value>
with values 3 and 100 I get 11 items.
mysql> select itemnotes from items where (itemnotes + 0) >= 3 and (itemnotes + 0) <= 100; ... 11 rows in set (1.16 sec)
The corresponding barcodes are also identical in both cases. So it seems to work on my small test install in my netbook.
Will check it in a larger test system with more varied canumber values in a few days and report back then.
The whole Zebra search syntax seems completely alien to me after being used to SQL.
Thanks for the tips.
Regards, Senthil
2010/12/17 Fridolyn SOMERS <fridolyn.somers@gmail.com>:
You are right,
I missed the @att type 4. Then, it should also be set on query.
I found another error : le and ge souldn't come with "=" : use ">=" ans "<=".
It gives :
"(canumber,st-numeric>=1000 and canumber,st-numeric<=2000) or sort1,canumber,st-numeric=0".
PS : The zero in sort1(...)=0 means that this sort in the first (in case there is a second sort, sort=1, etc).
If it doesn't work, send us the PQF(... @att ...) query from Zebra logs.
Regards,
On Fri, Dec 17, 2010 at 4:48 PM, LAURENT Henri-Damien <henridamien.laurent@gmail.com> wrote:
Le 17/12/2010 14:40, Fridolyn SOMERS a écrit :
Hie,
Have a look at @att 7 of Zebra :
http://www.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-at...
It introduces sorting into query.
In ccl.properties you find ascending and descending sort : /sort1 7=1 sort2 7=2/
So your ccl query looks like : /"(canumber,ge=1000 and "canumber,le=2000) or sort1,canumber=0"/
*_PS : _* You must add the sort structure (:s) into "record.abs" :
melm 952$z canumber, canumber:n, canumber:s, item
Regards,
Fridolyn, what you said is helpfull but not really fixes the problem... It appears that it lies in @attr 4=109 that should be used and not @attr 4=1 or @attr 4=6... That is to say Senthil has to tell on what TYPE of data he is trying to sort. Sorting on number is not the same as sorting alphabetical things. so in pqf it would be @or your query @attr 1=canumber @attr 7=1 @attr 4=109 1 in ccl yourquery or canumber,sort1,st-numeric=1 or edit the code so that it sends the correct queries. Hopes that helps...
Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- Fridolyn SOMERS ICT engineer PROGILONE - Lyon - France fridolyn.somers@gmail.com
participants (3)
-
Fridolyn SOMERS -
LAURENT Henri-Damien -
Senthil Anand