Forums / General / Search, advancedsearch and custom SQL scripts

Search, advancedsearch and custom SQL scripts

Author Message

Aleksander Lech

Friday 09 September 2005 6:18:42 am

Hi,
I'm trying to achieve something like this:
Searching works as ususal but <form action> on the search page points to my extension where (based on searched term) another search is made on custom DB tables. Both search results are presented on results page.
And its work to this moment.

Advanced search form on results page doesn't have input fields filled, dropdown lists are empty, and if I try to search by "phrase search" I don't have any results from ezPublish, just from custom search. If I search using 'typical search' field I got both results, but dropdown list are stil empty.

I think that maybe my way is not exactly good.
Here's some code"

extension's php script (overview.php)

<?php
include_once( 'kernel/common/template.php' );
include_once( 'kernel/content/search.php' );

function arr_clean(&$val) {
   $val=chop(trim($val));
}

if(isset($_REQUEST["SearchText"]) && $_REQUEST["SearchText"]!=""){
	
	$searchArr=$_REQUEST["SearchText"];
	$searchArr=explode(" ",$searchArr);
	array_walk($searchArr,'arr_clean');

};

if(isset($_REQUEST["PhraseSearchText"]) && $_REQUEST["PhraseSearchText"]!=""){
	$searchArr=$_REQUEST["PhraseSearchText"];
}


$tpl =& templateInit();

    include_once( 'lib/ezdb/classes/ezpostgresqldb.php' );  
	$db =& eZDB::instance();
    $wynik =& $db->arrayQuery( 'SELECT prac.*, inst.*, dz.* FROM pracownik prac, instytut inst, dzial dz WHERE	prac.id_dzial=dz.id_dzial AND dz.id_inst=inst.id_inst ',
                            array( 'offset' => 0, 'limit' => 10 ) );

	$tpl->setVariable('wynik', $wynik);
	
	$Result = array();
	$Result['content'] =& $tpl->fetch( 'design:bw_search.tpl');
	//$Result['content'] =& $tpl->fetch( 'design:nikiss/overview.tpl' );
	$Result['path'] = array( array( 'url' => false,
                                'text' => 'Wynik wyszukiwania' ) );
                                
?>

bw_search.tpl is standard advancedsearch.tpl file and is called using link: mysite__web_address/ez/index.php/plain/przeszukaj_baze_wiedzy

I'm not sure if it can be done this way.

Aleksander

Aleksander Lech

Thursday 22 September 2005 3:26:09 am

Well....
of course it was my mistake.
A was including search.php and using advancedsearch.tpl. Changing include from search.php to advancedsearch.php made things work great.

Aleksander

eZ debug

Timing: Jan 31 2025 01:35:08
Script start
Timing: Jan 31 2025 01:35:08
Module start 'content'
Timing: Jan 31 2025 01:35:08
Module end 'content'
Timing: Jan 31 2025 01:35:09
Script end

Main resources:

Total runtime0.3135 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0087 588.0547370.2813
Module start 'content' 0.00870.0146 958.33591,001.5625
Module end 'content' 0.02320.2902 1,959.89843,893.0391
Script end 0.3134  5,852.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00471.5122200.0002
Check MTime0.00140.4469200.0001
Mysql Total
Database connection0.00090.280110.0009
Mysqli_queries0.170054.24751410.0012
Looping result0.00220.70481390.0000
Template Total0.289792.410.2897
Template load0.00100.322610.0010
Template processing0.288792.098210.2887
Override
Cache load0.00070.222010.0007
Sytem overhead
Fetch class attribute can translate value0.00220.702810.0022
XML
Image XML parsing0.00030.110110.0003
General
dbfile0.02668.5006200.0013
String conversion0.00000.002230.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs