Forums / Extensions / ezFind search an array of nodes

ezFind search an array of nodes

Author Message

Fraser Hore

Thursday 25 November 2010 3:18:05 am

Is it possible to use ezFind to search within an array of nodes?

My scenario is that I have project class objects that have lessons class objects as children. I want to seach the lessons objects but be able to use the attributes of the project class as facets for the drill down.

My approach is to have one ezfind search which searches the lessons class objects using the search text. I then use lessons objects returned in the search results to create a unique list of the parent ids (the ids of the containing project objects).

I then have a second ezfind search which has search text = '' ( so it will find all ) and I want it to return all the project objects with ids included in the array of parent ids extracted from from the search of lesson objects. This way the drill down facets will find a subset of the project objects listed in the parent ids array. Unfortunately subtree_array returns only children so that didn't work.

Any ideas?

Thanks!

Fraser

Fraser Hore

Thursday 25 November 2010 4:09:05 am

Update: I discovered by testing other classes that the subtree_array and the filter path:node_id both return the root node given in the results. So the problem seems to be that my project class objects aren't being properly indexed for some reason.

If I try to do a basic search for:

{set $search=fetch( ezfind,search,
hash( 'query', '',
'filter', 'path:886'
))}

Node 886 isn't returned with the results. Only its children are returned.

Any idea why this may be happening?

Fraser Hore

Thursday 25 November 2010 9:18:13 am

UPDATE 2 - Problem Solved.

I discovered that the problem related to the presence of an object relations attribute in the project class. For some reason when objects had an item selected in the object relations attribute, they weren't indexed properly. I'm using http://projects.ez.no/ezfsolrdocumentfieldobjectrelation/ so perhaps that has something to do with it. I solved the problem by editing all the project objects to de-select the object relation, submit, re-edit, re-select and re-submit. After this the objects were all found and returned by the ezfind search.

Cheers,

Fraser

Nicolas Pastorino

Monday 29 November 2010 1:48:39 am

Hi Fraser !

Thanks for keeping up posted along the way, and good to hear you found a solution. I was to recommend to surface the issues you encountered directly on the project's page, but could notice you already did so on other subjects.

How about requesting membership to the project and bringing updates, based on your field experience ?

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Fraser Hore

Monday 06 December 2010 8:59:04 am

Hi Nicolas,

Good point. I'll try to use the project-specific forums where possible.

Cheers,

Fraser