Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#97 2017-03-10 00:43:51

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_search: when the default search is not enough

etc wrote #302588:

The response comes from etc_search, so the redirection should be ok. Could you test the modified version, please?
# Name: etc_search v0.9.5...

This modified version made the difference for me too! Thanks!


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#98 2018-06-11 12:59:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,352
Website

Re: etc_search: when the default search is not enough

Hi Oleg, forgive me if I’m raising something you’ve already resolved. My plugin version says 0.9.5 and your site also says 0.9.5 but maybe I don’t have all the most recent edits you’ve made above.

My search results were dramatically shorter after upgrading from 4.5.7 (dev) to 4.7, so I went in search of why and tried your debug-query output directly on the database.

I’m sure you’ll know why right away: for txp 4.7, the following lines need modifying from Expires ='0000-00-00 00:00:00' to Expires IS NULL:

			$count = "SELECT COUNT(*) FROM $table WHERE Status >= 4 AND Posted <= '$ts' AND (Expires ='0000-00-00 00:00:00' OR Expires>='$ts') $s_filter AND $query";
			$query = "SELECT *".($order ? '' : ", MATCH ($safe_search_fields) AGAINST ('$q') AS score")." FROM $table WHERE Status >= 4 AND Posted <= '$ts' AND (Expires='0000-00-00 00:00:00' OR Expires>='$ts') $s_filter AND $query";

need changing to:

			$count = "SELECT COUNT(*) FROM $table WHERE Status >= 4 AND Posted <= '$ts' AND (Expires IS NULL OR Expires>='$ts') $s_filter AND $query";
			$query = "SELECT *".($order ? '' : ", MATCH ($safe_search_fields) AGAINST ('$q') AS score")." FROM $table WHERE Status >= 4 AND Posted <= '$ts' AND (Expires IS NULL OR Expires>='$ts') $s_filter AND $query";

If I’m wrong or my syntax is wrong, do let me know.

EDIT: Just wanted to say, this really is a very powerful plugin. If you need to do anything a bit more complex than a regular search, then it’s an absolute GodOlegsend.


TXP Builders – finely-crafted code, design and txp

Offline

#99 2018-06-11 13:25:24

etc
Developer
Registered: 2010-11-11
Posts: 4,660
Website GitHub

Re: etc_search: when the default search is not enough

jakob wrote #312508:

Hi Oleg, forgive me if I’m raising something you’ve already resolved. My plugin version says 0.9.5 and your site also says 0.9.5 but maybe I don’t have all the most recent edits you’ve made above.

Oops, hi Julian, frankly, I don’t remember how, but 0.9.5 available on my site seems to be patched a good while ago. Sorry if I have forgotten or missed to change the version number, I guess 0.9.6 (still unreleased) was already a work in progress at that time.

Sorry for the trouble and thanks for the reminder and the appreciation. Please anyone using it on txp 4.6+ and (only if) facing this problem redownload the latest version.

Offline

#100 2018-07-17 05:54:09

lazlo
Member
Registered: 2004-02-24
Posts: 106

Re: etc_search: when the default search is not enough

Hi Oleg

I have a custom search fill form for search and want to incorporate etc_search with it but I can’t seem to do a live search. This is my first time doing a live search with etc_search, so passing the query seems opaque to me.

<!-- Search Block -->
                     <li>
                     <i class="search fa fa-search search-btn"></i>
                     <div class="search-open">
                     <form action="./index.php" method="get">
                     <div class="input-group animated fadeInDown">
                     <input type="hidden" name="s" value="search" />
                     <input name="q" type="text" class="form-control" placeholder="Search">
                     <span class="input-group-btn">                                    
                     <button type="submit" class="btn-u" type="button">Go</button>                                
                     </span>                               
                     </div></form> 
                     </div>
                     </li>
<!-- End Search Block --> 

My results code looks this this:

<!--=== etc_search ===-->
<txp:etc_search_results id="10" form="newslistHeadlines">
<txp:else />
<txp:variable name="no_news" value="NULL" />
</txp:etc_search_results>

If I manually put the query in the code above it works but doesn’t pick up query from the search form.
The default textpattern search code picks up the query.

Thanks
Les

Last edited by lazlo (2018-07-17 05:56:07)

Offline

#101 2018-07-18 10:46:30

etc
Developer
Registered: 2010-11-11
Posts: 4,660
Website GitHub

Re: etc_search: when the default search is not enough

Hi Leslie,

can not test right now, sorry, but try to replace

                     <form action="./index.php" method="get">
                     ...</form> 

with

                     <txp:etc_search id="10" action="./index.php" method="get">
                     ...</txp:etc_search>

Offline

#102 2018-07-24 16:07:34

lazlo
Member
Registered: 2004-02-24
Posts: 106

Re: etc_search: when the default search is not enough

etc wrote #313060:

<form action="./index.php" method="get">...

with

<txp:etc_search id="10" action="./index.php" method="get">...

That worked perfectly, thank you.

Another question:
Is there a way to can combine “ORDER BY section Desc” and “ORDER BY posted Desc” into a single call?
I want to separate the search results into Section results then list them by date.

Offline

#103 2018-07-24 17:07:54

etc
Developer
Registered: 2010-11-11
Posts: 4,660
Website GitHub

Re: etc_search: when the default search is not enough

lazlo wrote #313124:

Is there a way to can combine “ORDER BY section Desc” and “ORDER BY posted Desc” into a single call?
I want to separate the search results into Section results then list them by date.

Yes, the standard SQL syntax applies:

ORDER BY Section DESC, Posted DESC

Combined with <txp:if_different /> this should allow you to section the presentation if needed.

Offline

#104 2018-08-19 22:22:37

lazlo
Member
Registered: 2004-02-24
Posts: 106

Re: etc_search: when the default search is not enough

I get the following error when I used the code above, everything seems to work but is there a way to fix the error?

Tag error: <txp:etc_search id="10" action="./index.php" method="get"> ->  Textpattern Notice: Unknown tag attribute: method. while parsing form master_page_header_unity on page front

- L

Offline

#105 2018-08-20 07:39:09

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,352
Website

Re: etc_search: when the default search is not enough

lazlo wrote #313512:

I get the following error when I used the code above, everything seems to work but is there a way to fix the error?

Tag error: <txp:etc_search id="10" action="./index.php" method="get"> -> Textpattern Notice: Unknown tag attribute: method. while parsing form master_page_header_unity on page front...

It looks like method isn’t actually an attribute of etc_search so you can just remove it.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB