Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Help cleaning up bulky/slow sql calls
Another option, if you privilege Author_1
first: create a query with empty ({}
) logic and the following search string
{CONCAT(';', CONCAT_WS(';', custom_1,custom_2,custom_3), ';') LIKE '%;$0;%'} AND Section='Books' AND ID != <txp:page_url type="id" /> ORDER BY custom_4 DESC
and call
<txp:if_custom_field name="Author_1">
<txp:etc_search_results id="1" form="book_title" limit="40"
query='<txp:custom_field name="Author_1" />' />
<txp:else />
...
That’s more or less what you were doing before, but without cloning.
Last edited by etc (2014-10-10 15:04:47)
Offline
#26 2014-10-10 12:40:15
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Help cleaning up bulky/slow sql calls
etc wrote #284694:
current_ID
Pardon for asking a little OT: what is that current_ID
? Is current_ a prefix-like language entity that one can combine with any column name to get info on a specific field of the query’s own table row?
Last edited by uli (2014-10-10 12:43:55)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Help cleaning up bulky/slow sql calls
uli wrote #284696:
what is that
current_ID
? Is current_ a prefix-like language entity that one can combine with any column name to get info on a specific fieldof the query’s own table row?
No, pardon my loose notations, it’s only the current article ID as output by <txp:page_url type="id" />
in the query above, to exclude the current article from the search results.
Offline
#28 2014-10-10 15:12:44
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Help cleaning up bulky/slow sql calls
Ah, and I was already dreaming away … what I could do shortly … 8))
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#29 2014-10-11 19:26:01
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: Help cleaning up bulky/slow sql calls
gaekwad wrote #284693:
+1 for the SSD explanation. I have a similar thing here when working on localhost Magento: on my spinning drive, it’s slow as heck (many files called per operation – really, it’s crazy), but on a Digital Ocean SSD-based droplet – even the $5 option – it’s way faster.
I wish I had an SSD, this code has been “acceptable” one might say even fast for 4 years until last week and now dead dog slow.
Thank you everyone for the code help.
Offline
Re: Help cleaning up bulky/slow sql calls
lazlo wrote #284734:
I wish I had an SSD […]
If you’re interested, there was a healthy discussion about Digital Ocean (SSD) hosting here: forum.textpattern.com/viewtopic.php?id=40928
Offline
#31 2014-10-12 22:51:51
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: Help cleaning up bulky/slow sql calls
etc wrote #284694:
Ah, you want to output the books having the current
Author_1
(say,custom_1
) orEditor_1
(custom_11
) as contributors? This should work:
And that did work on my test site but my live site is on TXP 4.2 and it threw up a fatal error when try to go to the prefs file. I will be using this in my new revision though on TXP4.5:
Fatal error: Call to undefined function bouncer() in /home/talonboo/public_html/textpattern/lib/txplib_misc.php(594) : eval()'d code on line 52
I did manage to get something working off of Michael’s code, thank you Michael. It doesn’t exclude the feature book in the list but for now it is usable.
Unfortunately I have used Jeff Soo’s filter in one other spots and I hoping for some alternatives:
In english code grabs a list of names that are all in the Title Field by First Name/Initial(sometimes)/Last Name, takes into account Initial and sorts them by Last Name. There must be easier ways of doing this in the long past I used chh_article_custom to do this.
Cancel all that, the new rewrite will do it properly by storing a discrete last name.
Thanks again to everyone who pitched in.
Last edited by lazlo (2014-10-13 00:19:37)
Offline
Re: Help cleaning up bulky/slow sql calls
lazlo wrote #284742:
And that did work on my test site but my live site is on TXP 4.2 and it threw up a fatal error when try to go to the prefs file. I will be using this in my new revision though on TXP4.5:
Fatal error: Call to undefined function bouncer() in /home/talonboo/public_html/textpattern/lib/txplib_misc.php(594) : eval()'d code on line 52...
That’s it or csrf vulnerability, you’d better upgrade.
Offline
Re: Help cleaning up bulky/slow sql calls
lazlo wrote #284742:
And that did work on my test site but my live site is on TXP 4.2 […]
This won’t help your immediate problem, but you need to upgrade soon. Background info here: www.cvedetails.com/vulnerability-list/vendor_id-5344/product_id-9097/Textpattern-Textpattern.html
Edit: etc beat me to it, and said it better.
Last edited by gaekwad (2014-10-13 07:52:29)
Offline