How to make an attribute based search

Author Message

Fátima Chapri

Sunday 01 March 2009 1:43:12 am

Hi,

I need to make a search form for a specific area on my site and for a specific attribute of a class.
For that the following code:

<form action={"/content/advancedsearch/"|ezurl} method="get">
	Search in multiple attributes:
	<input type="hidden" name="SearchContentClassID" value="16" />
	<input type="hidden" name="Content_search_attribute_fulltext_classattribute_id[]" value="193" />
	<input type="text"	name="Content_search_attribute_fulltext_value[]" value="{$search_array_by_class_attribute_id['193']['value']}" />
	<input type="submit" value="Search" name="SearchButton">
</form>

But i can't get the results I want.
Am I doing anything wrong? Please help.

Łukasz Serwatka

Monday 02 March 2009 11:26:51 pm

Hi,

Take a loon on this documentation page:
http://ez.no/ezpublish/documentation/customization/components/search/custom_search_box

Also make sure that your class attribute is marked as searchable.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Fátima Chapri

Tuesday 03 March 2009 12:41:35 pm

Hi Lukasz,

Thanks a lot for the help.

I've already seen the documentation page you suggested me. In fact, I constructed the search form based on that documentation.

Here are some details:
- My class attribute is marked as searchable.
- I'm using ezPublish 3.9.3

I found an issue related with multi attribute based search here: http://issues.ez.no/7170
But it's related with ezPublish version 3.7, so i think the solution won't be applicable on my case.

Any other hints?

Fátima Chapri

Saturday 07 March 2009 5:29:35 am

Hi,

I didn't find a solution for my problem yet.
Do anyone have any idea?

Please help.

Kristof Coomans

Saturday 07 March 2009 9:43:32 am

Hi Fatima

Can you be a bit more specific, about what do you mean with "i can't get the results I want" ? You get some results back or none at all?

What's the datatype of the class attribute with id 193?

Are you using the standard search engine or another one from an extension?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Jean-Yves Zinsou

Saturday 07 March 2009 9:44:03 am

Hi,

what do you mean : "I can't get the results i want"?

No results at all ?
Or wrong results ?

You must set AllowEmptySearch=enabled in [SearchSettings] in your site.ini(.append) for this to work, because the normal search field is not used.

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Fátima Chapri

Sunday 08 March 2009 9:02:54 am

Hi,

Sorry, I really should be more specific.

Here are some more details:

- the class attribute with id 193 is a "keyword" and is marked as searchable.
- I'm using the standard ezpublish search engine.
- AllowEmptySearch=enabled is set

- When I try to make a search of a word or expression that I'm shore it's in that attribute, The result of the search is empty.

- The normal search of the site is working perfectly.

- The search form is not inside a cache block.

- As a test, I also tried to make a search form that searches only for a certain part of my node tree, and the search results were fine. Below is the code I used:

<form action={"/content/search/"|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="SubTreeArray[]" value="234" />
</form>

Jean-Yves Zinsou

Monday 09 March 2009 1:26:59 pm

Hi fàtima,
i am really out of arguments on this one..

As you code is the one used for the example it should work, a few tips:
- try to put AllowEmptySearch=enabled in settings override to be sure that it used
- is your word frequent in your database ? try these settings (http://ez.no/doc/ez_publish/technical_manual/4_0/reference/configuration_files/site_ini/searchsettings)
StopWordThresholdPercent= 100
StopWordThresholdValue=100
SearchViewHandling=template

Okay, it 's a rough try, but who knows....

Let us know if you succeed !!

Jey

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Fátima Chapri

Friday 13 March 2009 11:11:14 am

Hy Jean-Yves,

I'm sorry, I was not able to check in the forum in the last days.
I tried to what you said but without success.

I was searching for a similar problem as mine and I found that identical postings for the same problem without solution.

I thing it's a bug. But as I'm going to update the site for ezpublish 4. I'll see then if the problem persists.

I'll let you all know if I find a solution.

Fatima

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