Cool, that looks nice :)

From looking around, Lucene has to return all matching records to do the 
scoring anyway, and it only retrieves the full doc when you query it.

Simon's mention of memory reminded me to check my script usage, which came up 
with some interesting results.

My index contains 40,000 items after I first indexed my searches where taking 
1-2 seconds and using about 15MB of memory.

Then I optimised the index and now searches are taking 0.4 - 0.5 seconds and 
using only 5MB of memory.

So remember to optimise your indexes :)

I could maybe see memory becoming an issue as the article database grows, but 
it would probably be better then to separate the index to a separate server and 
index over a web service. 

Maybe theres a proposal in that Zend_Service_Lucene or 
Zend_Search_Lucene_Server :)

Thanks for the help guys

Keith Pope
Web Developer

-----Original Message-----
From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] 
Sent: 29 February 2008 11:54
To: fw-general
Subject: Re: AW: [fw-general] Zend_Search_Lucene - Pagination

A way to paginate the results from within ZSL itself would be great.

The way simon described is pretty much how I paginate my search results.
To make pagination a bit easier, I wrote Zym_Paginate 
(http://www.zym-project.com/download
)
It's a pagination component that can paginate normal arrays, collections with 
an Iterator implemented and results from a DB.
It works, but has received limited testing so far. Also, please be aware the 
API might change anytime.

With Zym_Paginate Simon's example would translate to something like
this:

$hits = new ArrayObject($index->find($query));
$paginate = new Zym_Paginate_Iterator($hits->getIterator());
$paginate->setRowLimit(15); // Display 15 results per page. Optional:  
defaults to 10
$page = $paginate->getPage(3); // Returns page 3


Hope it helps : )


On Feb 29, 2008, at 12:20 PM, Simon Mundy wrote:

> Yeah, but that's nothing to do with using the ArrayIterator or not - 
> at least using it is a cleaner way of accessing the data! I don't know 
> how easy it would be to implement a paging component within 
> Zend_Search itself... perhaps Alex would be the best person to comment 
> on that.
>
>> Afaik using an iterator won't get you anything. You can just as well 
>> use array_slice to extract the relevant hits. Memory consumption 
>> won't be affected since the find method returns the whole result 
>> array (using lots of
>> memory) no matter what you do with it afterwards.
>> Please correct me if I'm wrong.
>>
>> Best regards,
>>
>> Stefan Oestreicher
>>
>> --
>> Dr. Maté GmbH
>> Stefan Oestreicher / Entwicklung
>> [EMAIL PROTECTED]
>> http://www.netdoktor.at
>> Tel Buero: + 43 1 405 55 75 24
>> Fax Buero: + 43 1 405 55 75 55
>> Alser Str. 4 1090 Wien Altes AKH Hof 1 1.6.6
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Keith Pope [mailto:[EMAIL PROTECTED]
>> Gesendet: Freitag, 29. Februar 2008 11:10
>> An: fw-general
>> Betreff: RE: [fw-general] Zend_Search_Lucene - Pagination
>>
>>
>> Thx Simon thats great, I didnt know about the LimitIterator :)
>>
>> Keith Pope
>> Web Developer
>>
>> -----Original Message-----
>> From: Simon Mundy [mailto:[EMAIL PROTECTED]
>> Sent: 29 February 2008 10:07
>> To: Keith Pope
>> Cc: fw-general
>> Subject: Re: [fw-general] Zend_Search_Lucene - Pagination
>>
>> Hi Keith - here's my solution. Works OK so far...
>>
>>        $pg = current page (1 -> ...)
>>        $pp = per page (defaults to 10)
>>
>>        $index = Zend_Search_Lucene::open($this->_index);
>>        $query = Zend_Search_Lucene_Search_QueryParser::parse($query);
>>        $hits = new ArrayObject($index->find($query));
>>
>>        $results = new stdCLass();
>>        $results->total = count($hits);
>>        $results->hits = array();
>>
>>        if (!count($hits)) {
>>            // report no results...
>>        }
>>
>>        $hits = new LimitIterator($hits->getIterator(), ($pg - 1) * 
>> $pp, $pp);
>>
>>        foreach ($hits as $hit) {
>>            $result = new stdClass();
>>            $result->url = $hit->url;
>>            $result->title = $hit->title;
>>            $result->contents = $hit->contents;
>>            $results->hits[] = $result;
>>        }
>>
>>        // do stuff with $results...
>>
>>
>>>
>>> Hi,
>>>
>>> I am prototyping a site search using Zend_Search, and was wondering 
>>> if anyone had a good way of paginating the results?
>>>
>>>
>>> Keith Pope
>>> Web Developer
>>>
>>> -----Original Message-----
>>> From: Andi Gutmans [mailto:[EMAIL PROTECTED]
>>> Sent: 29 February 2008 05:55
>>> To: Jordan Moore; Kevin McArthur
>>> Cc: Michael B Allen; fw-general General; Wil Sinclair
>>> Subject: RE: [fw-general] License Compatibility
>>>
>>> Hi,
>>>
>>> You can't change the license of ZF itself but you can license your 
>>> code under any license which is compatible with the New BSD license 
>>> and I believe you can also license the collective work itself under 
>>> a different license. In general the New BSD license is very lax and 
>>> I don't know of a license it's not compatible with.
>>>
>>> It is typical for software vendors to bundle and update all the 
>>> pieces their application need so that their customers have an 
>>> out-of- the- box experience (e.g. Zend Core, our Certified PHP 
>>> distribution bundles a large amount of 3rd party libraries, PHP 
>>> extensions, Zend Framework and of course PHP itself).
>>>
>>> As to releasing updates we will likely follow a similar policy as 
>>> PHP has. This means releasing a new mini release with critical 
>>> security issues for the latest version of each major version which 
>>> has not been end of lifed. So currently we release updates for PHP 
>>> 4.4.x and PHP 5.2.x. For other versions (5.0, 5.1, 4.3, 4.2) 
>>> companies who don't want to upgrade need to deal with their own 
>>> patching. In many cases, they can leverage the patches which were 
>>> done for the last releases with little modification but no one can 
>>> guarantee that.
>>>
>>> Hope that helps. As Bill pointed out, don't trust legal advice you 
>>> get from anyone here including myself.
>>>
>>> Andi
>>>
>>>> -----Original Message-----
>>>> From: Jordan Moore [mailto:[EMAIL PROTECTED]
>>>> Sent: Thursday, February 28, 2008 11:15 AM
>>>> To: Kevin McArthur
>>>> Cc: Michael B Allen; fw-general General; Wil Sinclair
>>>> Subject: Re: [fw-general] License Compatibility
>>>>
>>>> I see two problems with requiring my users to download ZF
>>>> separately:
>>>>
>>>> 1. It's not user friendly. Users should be able to download a 
>>>> single archive, extract it, and install the application.
>>>>
>>>> 2. I can't guarantee compatibility with every version of ZF.
>>>>
>>>> Also, if I used the same logic with all included libraries for this 
>>>> application, users would need to download a total of 4 external 
>>>> libraries, and I would need to account for the varying versions of 
>>>> all
>>>> 4 libraries.
>>>>
>>>> By including the external libraries in my application's 
>>>> distribution, users only need to maintain a single application, not 
>>>> an application and 4 libraries.
>>>>
>>>> On Thu, Feb 28, 2008 at 10:53 AM, Kevin McArthur 
>>>> <[EMAIL PROTECTED]
>>>> >
>>>> wrote:
>>>>>
>>>>> I can't see any reason the BSD license would prevent this, 
>>>>> however,
>>>> the
>>>>> ideal solution would be to maintain an external reference to the
>>>> official
>>>>> framework repo, such that any fixes or changes could be 
>>>>> contributed
>>>> back
>>>>> under the CLA and therefore available to everyone.
>>>>>
>>>>> I'm not sure applications built upon the Zend Framework should
>>>> distribute
>>>>> the framework itself, as from time-to-time, there will likely be
>>>> security
>>>>> updates backported etc. Getting the latest version of a minor 
>>>>> version
>>>> say
>>>>> 1.0.3a should probably be the preferred approach.
>>>>>
>>>>> Some leadership from Zend on the whole packaging, distribution,
>>>> patching
>>>>> and security issues would be nice to have though.
>>>>>
>>>>> K
>>>>>
>>>>>
>>>>>
>>>>> Jordan Moore wrote:
>>>>> Not sure why I said MIT, since I had the license right in front of
>>>> me
>>>>> and it clearly says "New BSD License"... but thanks for the reply.
>>>>>
>>>>> If anyone has an opposing opinion, let me know...
>>>>>
>>>>> On Thu, Feb 28, 2008 at 10:35 AM, Michael B Allen 
>>>>> <[EMAIL PROTECTED]
>>>>> >
>>>> wrote:
>>>>>
>>>>>
>>>>> On 2/28/08, Jordan Moore <[EMAIL PROTECTED]> wrote:
>>>>>> I'm developing a distributable application that will be  >
>>>>> using/including the Zend Framework. I was planning on releasing
>>>> the
>>>>>> application with a Creative Commons Attribution-Share Alike 3.0 
>>>>>> License. Does anyone know if this is compatible with the MIT
>>>> license
>>>>>> that ZF is using?
>>>>>
>>>>> ZF isn't MIT. It's BSD with no advert. Although AFAIK they are 
>>>>> logically identical.
>>>>>
>>>>> Since BSD is pretty much a "do whatever you want" license then it 
>>>>> is basically compatible with everything. Go for it.
>>>>>
>>>>> In fact I think you could even take ZF and s/Zend/Jordan/g and 
>>>>> call
>>>> it
>>>>> "Jordan's Framework". For a while the Linux guys were taking 
>>>>> FreeBSD drivers and just ripping out the BSD license header and 
>>>>> putting in
>>>> the
>>>>> GPL header. But I think they stopped doing that because the BSD
>>>> people
>>>>> became very annoyed. And rightly so since it was effectively a 
>>>>> one-way-street because they could not bring any GPL'd patches back 
>>>>> into FreeBSD.
>>>>>
>>>>> Mike
>>>>>
>>>>> --
>>>>> Michael B Allen
>>>>> PHP Active Directory SPNEGO SSO
>>>>> http://www.ioplex.com/
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jordan Moore - Creative Director
>>>> Sanctus Studios LLC
>>>> PO Box 2202
>>>> Tacoma, WA 98401
>>>> (253) 238-8676
>>>
>>>
>>> --
>>> allpay.net Limited, Fortis et Fides, Whitestone Business Park, 
>>> Whitestone, Hereford, HR1 3SE.
>>> Registered in England No. 02933191. UK VAT Reg. No. 666 9148 88.
>>>
>>> Telephone: 0870 243 3434, Fax: 0870 243 6041.
>>> Website: www.allpay.net
>>> Email: [EMAIL PROTECTED]
>>>
>>> This email, and any files transmitted with it, is confidential and 
>>> intended solely for the use of the individual or entity to whom it 
>>> is addressed. If you have received this email in error please notify 
>>> the allpay.net Information Security Manager at the number above.
>>
>> --
>>
>> Simon Mundy | Director | PEPTOLAB
>>
>> """ " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
>>
>> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice 
>> +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
>> 4124
>> http://www.peptolab.com
>>
>>
>>
>> --
>>
>> allpay.net Limited, Fortis et Fides, Whitestone Business Park, 
>> Whitestone, Hereford, HR1 3SE.
>>
>> Registered in England No. 02933191. UK VAT Reg. No. 666 9148 88.
>>
>>
>>
>> Telephone: 0870 243 3434, Fax: 0870 243 6041.
>>
>> Website: www.allpay.net
>>
>> Email: [EMAIL PROTECTED]
>>
>>
>>
>> This email, and any files transmitted with it, is confidential and 
>> intended solely for the use of the individual or entity to whom it is 
>> addressed. If you have received this email in error please notify the 
>> allpay.net Information Security Manager at the number above.
>>
>
> --
>
> Simon Mundy | Director | PEPTOLAB
>
> """ " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
>
> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice 
> +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
> 4124
> http://www.peptolab.com
>
>



--

allpay.net Limited, Fortis et Fides, Whitestone Business Park, Whitestone, 
Hereford, HR1 3SE.

Registered in England No. 02933191. UK VAT Reg. No. 666 9148 88.



Telephone: 0870 243 3434, Fax: 0870 243 6041.

Website: www.allpay.net

Email: [EMAIL PROTECTED]



This email, and any files transmitted with it, is confidential and intended 
solely for the use of the individual or entity to whom it is addressed. If you 
have received this email in error please notify the allpay.net Information 
Security Manager at the number above.

Reply via email to