Combining search and list fetches?

Author Message

Jordan Hirsch

Friday 06 February 2009 2:20:08 pm

I'm trying to build an advanced search form with multiple criteria (searching objects of only one class). Most of the criteria are things that can be handled with a content/list fetch using attribute_filter, e.g. "such-and-such attribute >= 25". However, I would like to have a general search field as part of the form, where the user can type in words and have eZ Publish do a content/search fetch to search inside any attribute in the class definition marked as searchable. Is there any way to combine these 2 types of searches into 1 search, so that the end result is "objects where attribute_x >= 25 AND attribute_y < 10 AND [any_searchable_field] contains 'mystring'"?

I've done something similar in the past, but it involved merging lots of arrays on my own and then writing a custom javascript paginator to page through the resultset because I lost access to the "offset" functionality of the fetch template operator, since I was paging through a custom array of results as opposed to the results of a normal fetch operation.

I've never written an extended attribute filter, but I'm not sure if that is the answer to my problem. I would greatly appreciate any advice!

Thank you.

Me: http://jordan.teamhirsch.com
My blog: http://wiredformusic.blogspot.com
My other company: http://thinkimprov.com
eZ Certification: http://auth.ez.no/certification/verify/402488
eZ Award: http://ez.no/company/news/ez_awards_2007_prize_winners

Jordan Hirsch

Friday 06 February 2009 2:23:11 pm

I should mention: I'm using 4.0.1, and I know that I can achieve this by explicitly listing each searchable attribute in my content/list fetch and doing a "like" match, but of course that leaves out the all-important XML block fields. Any way around that?

Me: http://jordan.teamhirsch.com
My blog: http://wiredformusic.blogspot.com
My other company: http://thinkimprov.com
eZ Certification: http://auth.ez.no/certification/verify/402488
eZ Award: http://ez.no/company/news/ez_awards_2007_prize_winners

Ivo Lukac

Saturday 07 February 2009 3:54:42 am

Hello,

Check eZFind 2.0 facet functionality, this is closest to what you are looking for.

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Jordan Hirsch

Saturday 07 February 2009 5:47:00 am

Thank you, Ivo. I see there is documentation up for eZ Find 1.0 (http://ez.no/doc/extensions/ez_find) - do you know if there is documentation available for 2.0? "Facet" search isn't mentioned in the 1.0 manual; I'm not sure what that is.

Thanks again!

Me: http://jordan.teamhirsch.com
My blog: http://wiredformusic.blogspot.com
My other company: http://thinkimprov.com
eZ Certification: http://auth.ez.no/certification/verify/402488
eZ Award: http://ez.no/company/news/ez_awards_2007_prize_winners

Ivo Lukac

Saturday 07 February 2009 6:22:13 am

eZFind 2.0 is in beta. Launch is this month I think.
Here you can download future manual and see facets capabilities:
http://svn.ez.no/svn/extensions/ezfind/docs/ezfind_1.1_manual.odt

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Jordan Hirsch

Saturday 07 February 2009 11:50:45 am

Ivo,

Thanks again for the info & the link. I think this might be exactly what I need. I appreciate the help!

Me: http://jordan.teamhirsch.com
My blog: http://wiredformusic.blogspot.com
My other company: http://thinkimprov.com
eZ Certification: http://auth.ez.no/certification/verify/402488
eZ Award: http://ez.no/company/news/ez_awards_2007_prize_winners

Jan Komárek

Saturday 21 February 2009 9:41:33 am

I am solving same problem right now. But I can´t use ezFind because of customer rage againts Java...

Is there any other way to tho this? Some way how to add attribute filter to fetch search function? Or anythink else.

Thanks for help.

BTW: I think this is relative common requirment of webapllications.

Ivo Lukac

Saturday 21 February 2009 10:56:00 am

HI,

It should be, yes :)

Without ezFind you can only filter out nodes in template when already searhed. It complicates paging and uses more resources of course.

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Andy Caiger

Thursday 18 August 2011 9:11:48 pm

We're facing a similar kind of challenge, and eZFind is not an option for us either. Filtering the nodes using a content/list fetch and then searching the filtered array of nodes using content/search is one solution. I can see that this solution really complicates paging.

Another solution might be to use the method proposed for indexing child nodes in http://share.ez.no/learn/ez-publish/helper-child-nodes-user-friendly-search-results-and-preventing-full-node-views/%28page%29/4, except that we don't use it to build an index attribute in the parent nodes, just in the nodes with the XML block attribute you want to search. In other words, use workflow to prepopulate a non-XML copy of the XML block. Then a single content/list fetch using 'LIKE' in the attribute filters would return the results you want. Does anyone have any ideas about this second approach?

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.