Please help the Newbie...

Please help the Newbie...

Monday 13 September 2004 7:27:54 am - 7 replies

Modified on Tuesday 14 September 2004 2:11:07 am by Koos TDK

Author Message

Lazaro Ferreira

Monday 13 September 2004 11:27:05 am

Hi,

You will have to create a custom search page, using the search operator

Look at this URL
http://ez.no/ez_publish/documentation/reference/data_fetching/content/search

Lazaro

Lazaro
http://www.mzbusiness.com

Koos TDK

Tuesday 14 September 2004 12:28:23 am

Hi Lazaro

Thanks for your help. I have had a look at the search operator, but I have been lost(or just too stupid!) in figuring out how to get the search done since it seems to be a "dual" search solution, i.e. 1.) I will get the text the person want to search for from a text box on the website(say it is "orange" for argument's sake), then 2.) he/she selects a geographical region from a drop-down list for which to filter(say "ohio" for argument's sake).(The value will be available from what the person has selected in the drop-down list).

<b>Thus EZP must be able to search:</b>
1.) For the text "orange" only in my custom content class(id=32)
2.) But only return results where "ohio" matches the text in the "region" attribute(id=245) of content class 32, which is of datatype "selection". I have added the possible options that can be selected as elements of the "selection" datatype, so those values are static.

THANKS!! :-)

Koos TDK

Tuesday 14 September 2004 7:35:12 am

OK, have done some testing, but so far a bit disappointing.

The following code in pagelayout.tpl allows the user to enter text to search for in a form. This search is only done against the "Region" attribute of the class.

This is the second part of the solution to my problem. But how do I do the MAIN search in the rest of the attributes with this solutions as the "filter" or "constraint"?? A looped search? Is there an easier way or am I missing somethin?

<form action={"/content/advancedsearch/"|ezurl} method="get"> 
<input class="searchbox" type="text" size="8" name="SearchText" id="Search" value="" />
<input class="searchbutton" name="SearchButton" type="submit" value="Search" />
<input type="hidden" name="SearchContentClassID" value="32" />
<input type="hidden" name="SearchContentClassAttributeID" value="245" />
</form> 

Thanks!

Koos TDK

Wednesday 15 September 2004 4:53:27 am

Hi!

Using version 3.4.1

It seems like the code below should give me the required results(According to all my research on the forums). But it does not return ANY results and there are no debugging errors being returned! (Yes, there is a single item that matches an "and" on those attributes and values).

<b>I have this code in my "pagelayout.tpl" file -- should it maybe be somewhere else? Could this be the problem?</b>

{section loop=fetch(content,tree,hash(parent_node_id, 105, attribute_filter,
 array(and,array(240,'like','%orange%'), array(245,'like','%ohio%'))))
}
{$:item.name}
{/section}

Any help will be much appreciated!

Paul Borgermans

Wednesday 15 September 2004 5:09:47 am

Did you use the patched ezcontentobjecttreenode.php file from teh contributions? the 'like' operator is not supported by default.

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Koos TDK

Thursday 16 September 2004 7:27:40 am

Hi Paul

Thanks for the reply. Yes, I have copied the new ezcontentobjecttreenode.php to "/kernel/classes".

I have tested only filtering on a single attribute and it works 100%, like so:

{section loop=fetch(content,list,hash(parent_node_id, 105, attribute_filter,
 array(and,array(240,'like','%orange%'))))
}

This then returns only entries with "orange" in attribute 240.(But only the value of the first attribute in the object).

BUT there is a problem when trying to filter on a second attribute, it does not return any results! Even when specifying to search for "%" in the firts attribute and "%n%" in the other, it returns nothing, the code:

{section loop=fetch(content,list,hash(parent_node_id, 105, attribute_filter, 
array(and, array(240,'like','%'), array(245,'like','%n%'))))
}

Also, the fetch only returns the value of the very first attribute of the object, I have tried changing the "list" to "tree" but I don't see any difference in the results.

This is driving me mad, so close, but it just doesn't want to work!!

ANY help greatly appreciated(again!) :-)

Andrew Vorobyov

Sunday 29 May 2005 12:42:29 am

Koos is not alone!

please help folks...

You must be logged in to post messages in this topic!

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