Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2012-11-15 09:25:46

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

Thank you, Keith, your (and others) support incites me to spend more time on etc_search. All suggestions are welcome.

Offline

#14 2012-11-18 17:10:59

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

Version 0.8.9: can partially (no pagination for the moment) replace the txp default search, as requested. Some attributes changes, please read the help. Only php file is modified.

Offline

#15 2013-11-12 10:12:08

wordgasm
Member
Registered: 2006-05-17
Posts: 83
Website

Re: etc_search: when the default search is not enough

The “live” attribute still produces “true” results even when set to “false”. Why is that?

Offline

#16 2013-11-12 10:36:07

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

wordgasm wrote:

The “live” attribute still produces “true” results even when set to “false”. Why is that?

Hi,

“false” is a string, not a Boolean. You should assign live attribute some “empty” php value: live="0", for example.

Offline

#17 2013-11-15 22:07:13

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

Beta 0.9 is released. It is not directly compatible with 0.8.9, so please test it before upgrade. Main news:

  • sensible attributes have migrated to the admin side, mainly for security reasons;
  • pagination should work now, including etc_pagination and other plugins;
  • easier to configure for searching files, images and links.

It is already on duty, though the description still corresponds to the official 0.8.9 version. The plugin help may be a bit outdated too, please complain if so.

Download and feed me back.

Last edited by etc (2013-11-29 14:04:28)

Offline

#18 2013-11-29 14:04:04

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

Version 0.9 is released. Both plugin and javascript files must be upgraded. It is not directly compatible with 0.8.9, be careful when upgrading.

More secure and more configurable than the previous version. One can customize search queries, search input form, search results output, animation effects and so on. Accidentally, it can be used as <txp:article_custom /> tag enhanced with powerful where attribute.

The demo is here. But I am still bad at help writing, sorry! :)

Offline

#19 2014-01-15 14:38:42

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: etc_search: when the default search is not enough

Hi Oleg, can you give me an example of how you might implement faceted search using this plug in? I’m just contemplating a potential project and want to know how easy it’s going to be!

Offline

#20 2014-01-15 15:04:13

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

Hi Doug,

if you go to plugins homepage, the search in the left sidebar is faceted, accepting term, #keyword or @category. If you search for pag @tips, it will bring you all tips containing “pag”. It’s done with the following etc_search form:

{Title,Body::/^[^@#]/;Title,Keywords::/^#([\w\-]+)$/::{*} LIKE '%$1%';Category1,Category2::/^@([\w\-]+)$/::{*} LIKE '%$1%'}

It contains 3 ;-separated search patterns:

  • Title,Body::/^[^#]/@ means “search for the search string in Title or Body if the string doesn’t start with @ or #”;
  • Title,Keywords::/^#([\w\-]+)$/::{*} LIKE '%$1%': if the search string starts with #, search for the term that follows # in Title or Keywords;
  • and so on

The patterns are of the form

field1,field2,...::regexp_that_triggers_the_pattern::mysql_comparison_operator

Don’t hesitate if you need some help

Offline

#21 2014-01-15 16:13:45

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: etc_search: when the default search is not enough

Thanks for the quick reply. I take it you could accomplish something a little more traditional with multiple select fields?

Looks like I’ve got something else to have a play around with!

Offline

#22 2014-01-15 17:32:29

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

douglgm wrote #278165:

Thanks for the quick reply. I take it you could accomplish something a little more traditional with multiple select fields?

Combining multiple select fields into one search query is possible, but it would help me a lot to see an example of what you are looking for.

Offline

#23 2014-02-20 16:14:09

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: etc_search: when the default search is not enough

Hi

Is this plugin is working under txp 4.5.5? i tried to install it but failed with error

Parse error: syntax error, unexpected T_FUNCTION in /htdocs/textpattern/lib/txplib_misc.php(812) : eval()'d code on line 392
Les erreurs ci-dessus ont été causées par le plugin :etc_search

Offline

#24 2014-02-23 10:20:57

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: etc_search: when the default search is not enough

Hi Rabah, sorry for the delayed reply (was offline).

Yes, etc_search works with txp 4.5.5 on its homepage (php 5.4). I have also tried a fresh install from the download link that went well. The only reason I can see is that your php version does not support anonymous functions in preg_replace_callback (line 392 in the plugins code). If so, try to declare this function separately:

function etc_search_workaround ($matches) {
	global $etc_search_match;
	@list($res, $sep) = explode('&', $matches[1], 2) + array(null, ',');
	if(!$etc_search_match || !isset($_REQUEST[$res])) {$etc_search_match = false; return '';}
	return urldecode(is_array($res = gps($res)) ? implode($sep, $res) : $res);
}

and replace lines 392—397 with

$params['q'] = trim(!$etc_format ? gps('q') : preg_replace_callback("/\{(.+)\}/Us", 'etc_search_workaround', htmlspecialchars_decode($etc_format)));

Hope that helps.

Offline

Board footer

Powered by FluxBB