Forums / Setup & design / Custom advanced search question

Custom advanced search question

Author Message

Roberto Frascarelli

Monday 07 March 2005 2:42:17 am

Hi all,
I have a custom class "Announce" with a category (single selection) attribute and some other searchable contents.

I want to implement a custom search on those objects with two search fields: one text field for text search and one selectbox with category selection.

I know how to use "SearchContentClassAttributeID" field to limit the searched text to a single attribute, but what I want is to limit the search results of the searched text to objects that have a specific category value.

I can't find the way to use advanced search to obtain this in one step.
The only way I founded is to filter the results after the search, but this is not very efficient.

Thanks in advance for suggestions.

Ɓukasz Serwatka

Monday 07 March 2005 10:20:05 pm

Hi Roberto,

Maybe some of this information will be useful for you.
http://ez.no/community/bugs/search_lacks_multi_attribute_queries

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

Yelitza Jaramillo

Thursday 10 March 2005 1:11:12 am

Hi Roberto,

If you want to narrow your search results by some specific attributes, you can do so making use of the advancesearch module and overriding the template "/standard/templates/content/advancesearch.tpl", you need to fill the array "Content_search_attribute...." with the new search requirements. Here is an example, i have a class "Studium" with this attributes : name (text line), poeng (text line) and varighet (text line). I want to set a customized advanced search where the search is done only in the object with an specific varighet (lets say the id for this attribute is 195), the form in my template looks like this :

<form method="get" action={'/content/advancedsearch'|ezurl}>
<input type="text" name="SearchText" value="{$full_search_text}" >
Varighet:
<input type="hidden" name="Content_search_attribute_fulltext_classattribute_id[]" value="195" />
<input type="text" name="Content_search_attribute_fulltext_value[]"               value="{$search_array_by_class_attribute_id['195']['value']}" />
<input type="submit"  value="Search" name="SearchButton">

As you can see, after one search is done, you get the values entered before in the array "$search_array_by_class_attribute_id".

You can also narrow the search using ranges

Age:
<input type="hidden" name="Content_search_attribute_byrange_classattribute_id[]" value="400" />
From:<input type="text" name="Content_search_attribute_byrange_from[]" value="" />
To: <input type="text" name="Content_search_attribute_byrange_from[]" value="">

 

Or if you are searching in an attribute of the integer type:

Age:
<input type="hidden" name="Content_search_attribute_integer_classattribute_id[]" value="400" />
<input type="text" name="Content_search_attribute_integer_value[]" value="" />

 

Hope this helps.

Roberto Frascarelli

Thursday 10 March 2005 5:42:06 am

Thanks Yelitza,
you have been very useful with your clarifying example.

My custom search works well now.
This is my code :


<form action={"/content/advancedsearch"|ezurl} method="get">
  <div whitespace=nowrap>
 <b>Find in announces :</b> <input type="text" id="searchtext" name="SearchText" size="25">
   <input type="hidden" name="Content_search_attribute_fulltext_classattribute_id[]" value="320" />
    Category: <select name="Content_search_attribute_fulltext_value[]">
                 <option value=""></option>
                 <option value="Deliberations">Deliberations</option>
                 <option value="Regulations">Regulations</option>
                 <option value="Various">Various</option>
               </select>
     <input id="searchbutton" class="button" name="SearchButton" type="submit" value="Search" />
   </div>
  <input type="hidden" name="SubTreeArray" value="169"  />
  <input type="hidden" name="SearchContentClassID" value="42"  / >
</form>

Some of your examples should have to be inserted under the documentation pages,
perhaps adding an "attribute value search" here:
http://www.ez.no/ez_publish/documentation/customization/components/search/custom_search_box

Gunnstein Lye

Wednesday 16 March 2005 7:50:57 am

Hi,

I added a description of the attribute based search here:
http://ez.no/ez_publish/documentation/customization/components/search/custom_search_box

eZ debug

Timing: Jan 18 2025 01:05:02
Script start
Timing: Jan 18 2025 01:05:02
Module start 'content'
Timing: Jan 18 2025 01:05:02
Module end 'content'
Timing: Jan 18 2025 01:05:03
Script end

Main resources:

Total runtime0.8402 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 587.7266180.8359
Module start 'content' 0.00610.7202 768.5625673.5469
Module end 'content' 0.72630.1139 1,442.1094341.0938
Script end 0.8402  1,783.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4529210.0002
Check MTime0.00140.1638210.0001
Mysql Total
Database connection0.00050.065210.0005
Mysqli_queries0.747889.00072040.0037
Looping result0.00200.23712020.0000
Template Total0.811596.620.4057
Template load0.00180.213120.0009
Template processing0.809796.367920.4048
Template load and register function0.00010.010410.0001
states
state_id_array0.00180.219610.0018
state_identifier_array0.00100.116520.0005
Override
Cache load0.00160.1846450.0000
Sytem overhead
Fetch class attribute can translate value0.00130.156950.0003
Fetch class attribute name0.00140.161790.0002
XML
Image XML parsing0.01221.456250.0024
class_abstraction
Instantiating content class attribute0.00000.0021100.0000
General
dbfile0.01451.7232460.0003
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 38
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs