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.

eZ debug

Timing: Jan 18 2025 02:48:42
Script start
Timing: Jan 18 2025 02:48:42
Module start 'layout'
Timing: Jan 18 2025 02:48:42
Module start 'content'
Timing: Jan 18 2025 02:48:43
Module end 'content'
Timing: Jan 18 2025 02:48:43
Script end

Main resources:

Total runtime0.6858 sec
Peak memory usage4,096.0000 KB
Database Queries80

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.9219152.6250
Module start 'layout' 0.00630.0031 740.546939.4609
Module start 'content' 0.00940.6748 780.0078710.3359
Module end 'content' 0.68420.0016 1,490.343824.1563
Script end 0.6857  1,514.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4802160.0002
Check MTime0.00140.1979160.0001
Mysql Total
Database connection0.00100.138710.0010
Mysqli_queries0.610889.0666800.0076
Looping result0.00090.1288780.0000
Template Total0.655095.520.3275
Template load0.00190.283820.0010
Template processing0.653195.229120.3265
Template load and register function0.00010.015710.0001
states
state_id_array0.00110.164610.0011
state_identifier_array0.00170.248820.0009
Override
Cache load0.00170.2472470.0000
Sytem overhead
Fetch class attribute can translate value0.00070.097240.0002
Fetch class attribute name0.00120.1779130.0001
XML
Image XML parsing0.00180.261940.0004
class_abstraction
Instantiating content class attribute0.00000.0050180.0000
General
dbfile0.00120.1775340.0000
String conversion0.00000.001640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 34
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs