[Koha-devel] Koha - Searching for Lexile Range

savitra sirohi savitra.sirohi at osslabs.biz
Wed Jan 20 12:11:54 CET 2010


Richard,

Sorry, here is the patch (forwarded message below), this is on the
current git clone (3.2).


Thanks,
Savitra Sirohi
Nucsoft OSS Labs
http://www.osslabs.biz




---------- Forwarded message ----------
From: Amit Gupta <amit.gupta at osslabs.biz>
Date: Wed, Jan 20, 2010 at 4:30 PM
Subject: [Koha-patches] [PATCH] Patch of Lexile Search box on Opac
advance search page
To: koha-patches at lists.koha.org
Cc: Amit Gupta <amit.gupta at osslabs.biz>


---
 .../opac-tmpl/prog/en/modules/opac-advsearch.tmpl  |   11 +++++++
 opac/opac-search.pl                                |   30 ++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
index d12fd73..d3ec074 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
@@ -104,6 +104,17 @@

    </fieldset></div>
    </div>
+
+<!-- Lexile Search Box start-->
+<fieldset>
+<legend>Limit by: </legend>
+<p><label for="lex">Lexile Number:</label>
+<input size="8" name="lex" id="" value=""/>
+<label for="lex1">To</label>
+<input size="8" name="lex1" id="" value=""/>
+</p>
+<!--Lexile Search Box End-->
+</fieldset>
 <div id="pubrange" class="container">
 <fieldset>
 <!-- PUB RANGE OPTION -->
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 344f168..9025b9d 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -52,6 +52,11 @@ elsif ($build_grouped_results) {
 elsif ((@params>=1) || ($cgi->param("q")) ||
($cgi->param('multibranchlimit')) || ($cgi->param('limit-yr')) ) {
       $template_name = 'opac-results.tmpl';
 }
+##For Lexile Search Box##
+elsif ((@params>=1) || ($cgi->param("q")) ||
($cgi->param('multibranchlimit')) || ($cgi->param('lex')) ||
($cgi->param('lex1')) ) {
+        $template_name = 'opac-results.tmpl';
+}
+
 else {
    $template_name = 'opac-advsearch.tmpl';
    $template_type = 'advsearch';
@@ -321,6 +326,31 @@ if ($params->{'limit-yr'}) {
        #FIXME: Should return a error to the user, incorect date
format specified
    }
 }
+##Lexile Search Box##
+my $lex;
+my $lex_level;
+if ($params->{'lex'} and $params->{'lex1'}){
+#   if(($params->{'lex'} = ~/\d/ and $params->{'lex1'}= ~/\d/))
+{
+    my ($a1) = $params->{'lex'};
+    my ($a2) = $params->{'lex1'};
+    $lex = "lex,st-numeric,ge=$a1 and lex,st-numeric,le=$a2";
+    $lex_level= "$a1-$a2";
+    }
+    push @limits,$lex;
+}
+elsif ($params->{'lex'} =~ /\d/) {
+        $lex = "lex,st-numeric,ge=$params->{'lex'}";
+        $lex_level = $params->{'lex'};
+
+  push @limits,$lex;
+
+}
+ elsif ($params->{'lex1'} =~ /\d/) {
+        $lex = "lex,st-numeric,le=$params->{'lex1'}";
+        $lex_level = $params->{'lex1'};
+  push @limits,$lex;
+}

 # Params that can only have one value
 my $scan = $params->{'scan'};
--
1.5.4.5

On Tue, Jan 19, 2010 at 11:20 PM, Richard Forristall
<Richard.Forristall at goodwillaz.org> wrote:
> Hi again,
> Savitra,
>
> I've been on another project for a couple of days - did I miss you sending your code?
>
> Thanks,
>
> Rick
> -------------------------------------------
> Rick Forristall
> Programmer Analyst
> Goodwill of Central AZ
> 602.535.4078
> -------------------------------------------
>
> -----Original Message-----
> From: savitra sirohi [mailto:savitra.sirohi at osslabs.biz]
> Sent: Thursday, January 14, 2010 3:32 AM
> To: Richard Forristall
> Cc: Nicole Engard; koha-devel
> Subject: Re: [Koha-devel] Koha - Searching for Lexile Range
>
> Richard,
>
> The lexile numbers should be in 521$a.
>
> I will supply the code later this week (we are off today), not jquery, I don't think.
>
> Nicole, on including this in advanced search, sure we will submit a patch.
>
> Thanks,
> Savitra
>
> On Wed, Jan 13, 2010 at 11:47 PM, Richard Forristall <Richard.Forristall at goodwillaz.org> wrote:
>> This is indeed awesome and just what our librarian is looking for - are you using jQuery to build the query from the input boxes before sending the search?
>>
>> Also, where in the MARC record and koha database are the lexile
>> numbers supposed to be stored?  I'm not sure yet the numbers are being stored correctly in our data - I did a search for all lexile numbers < 900 and go no results. I used this in the main OPAC page's search box lex,st-numeric,lt:900 and I searched in the Library Catalog.
>>
>>
>>
>> Thanks,
>>
>> Rick
>> -------------------------------------------
>> Rick Forristall
>> Programmer Analyst
>> Goodwill of Central AZ
>> 602.535.4078
>> -------------------------------------------
>>
>> -----Original Message-----
>> From: Nicole Engard [mailto:nengard at gmail.com]
>> Sent: Wednesday, January 13, 2010 10:51 AM
>> To: savitra sirohi
>> Cc: Richard Forristall; koha-devel
>> Subject: Re: [Koha-devel] Koha - Searching for Lexile Range
>>
>> This is awesome - is this something we can integrate into the Koha advanced search page?
>>
>> Nicole
>>
>> On Wed, Jan 13, 2010 at 11:56 AM, savitra sirohi <savitra.sirohi at osslabs.biz> wrote:
>>> Richard,
>>>
>>> Yes, you should use "lex" in the searches, it is a numeric index so
>>> you use operators like "lt" (less than) or "le" (less than and equal
>>> to). Searches should be in this fashion:
>>>
>>> lex,st-numeric,lt:500
>>> lex, st-numeric,le:800 and lex, st-numeric, ge: 300
>>>
>>> See this DC Everest's OPAC to see this in operation (use reading
>>> program drop down):
>>> http://koha.dce.k12.wi.us/
>>>
>>> Thanks,
>>> Savitra Sirohi
>>> Nucsoft OSS Labs
>>> http://www.osslabs.biz
>>>
>>> On Wed, Jan 13, 2010 at 9:42 PM, Nicole Engard <nengard at gmail.com> wrote:
>>>> Richard,
>>>>
>>>> There is one tip in the manual:
>>>> http://koha.org/documentation/manual/3.2/searching/advanced-search-p
>>>> r efixes/view?searchterm=lexile I haven't done much other than that
>>>> :)
>>>>
>>>> Nicole
>>>>
>>>> 2010/1/13 Richard Forristall <Richard.Forristall at goodwillaz.org>:
>>>>> Good day all!
>>>>>
>>>>> I'm new to the Koha system - we're using it for our charter high
>>>>> school library.  We've only had it installed for about 2 months and
>>>>> I'm now responsible for maintenance and enhancements.
>>>>>
>>>>> In our library, we need the ability for users (high school
>>>>> students) to be able to search for books using a lexile number range.  For example:
>>>>> Find all the books that have a lexile number between 100 and 200.
>>>>>
>>>>> I don't see this as an option anywhere in the advanced search so I
>>>>> was going to try and create the option.  Here are my questions:
>>>>>
>>>>> 1.  Has anyone done this yet?
>>>>>
>>>>> 2.  I'm assuming there has to be something in the Zebra indexing
>>>>> system that allows this - being ignorant of Zebra, can anyone assist?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Rick
>>>>> -------------------------------------------
>>>>> Rick Forristall
>>>>> Programmer Analyst
>>>>> Goodwill of Central AZ
>>>>> 602.535.4078
>>>>> -------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> Koha-devel mailing list
>>>>> Koha-devel at lists.koha.org
>>>>> http://lists.koha.org/mailman/listinfo/koha-devel
>>>>>
>>>> _______________________________________________
>>>> Koha-devel mailing list
>>>> Koha-devel at lists.koha.org
>>>> http://lists.koha.org/mailman/listinfo/koha-devel
>>>
>>
>



More information about the Koha-devel mailing list