Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How?
  3. » Site Search

#1 2021-03-29 05:38:48

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 108
Website

Site Search

I’m really happy with the redesign of the Wandering Italy Blog, as it seems to be twice as fast as before. There are a few issues I need to fix but one that has me stumped is that when I use site search for a term that doesn’t appear on the site I get a pretty blank page with just the title. There isn’t a “no search matches” displayed when that occurs, which I’d expect because I’m using the stock search_display form and only the title and pagination from it seem to work. Any clues?

james

Offline

#2 2021-03-29 08:17:45

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

Re: Site Search

It looks like this part of your search_display is either missing or not processed, please check:

<txp:if_search_results>

    <!-- if search result count greater than 200 then display excessive results message, otherwise show search result count -->
    <txp:if_search_results max="200">
        <h3>
            <txp:search_result_count />
            <txp:text item="matching_search_request" />
            <q><txp:search_term /></q>
        </h3>
    <txp:else />
        <h3>
            <txp:text item="too_common_search_term" />
            <q><txp:search_term /></q>
        </h3>
    </txp:if_search_results>

<!-- if no search results, then display no search results message -->
<txp:else />
    <h3>
        <txp:text item="no_search_matches" />
    </h3>

</txp:if_search_results>

Offline

#3 2021-03-29 14:26:01

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 108
Website

Re: Site Search

etc wrote #329558:

It looks like this part of your search_display is either missing or not processed, please check:

<txp:if_search_results>...

It’s there, it’s just not being processed.

Offline

#4 2021-03-29 18:35:06

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

Re: Site Search

jrmartin wrote #329563:

It’s there, it’s just not being processed.

Intriguing. What txp version are you using, 4.8.4 or 4.8.5? Anyway

  • check whether all files have been uploaded ok (via Diagnostics)
  • check eventual error messages in Debug mode
  • check secondpass preference value (in txp_prefs table) if set
  • replace the opening <txp:if_search_results> with <txp:if_search_results[-1]> to try to fix it manually

Offline

#5 2021-03-29 18:53:34

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 108
Website

Re: Site Search

It’s version 8.4, but my wife’s site, Martha’s Italy, is the same with an earlier version.

A relevant piece of the debugging, I think:

96.31 |          | [ ~~~ secondpass (1) ~~~ ]
     96.33 |          | [true]
     96.54 |     0.10 | <txp:if_search_results>
     96.55 |          | 	[true]
     96.56 |     0.08 | 	<txp:if_search_results max="200">
     96.58 |          | 		[true]
     96.59 |     0.02 | 		<txp:search_result_count />
     96.61 |     0.02 | 		<txp:text item="matching_search_request" />
     96.63 |     0.01 | 		<txp:search_term />
     96.64 |          | 	</txp:if_search_results>
     96.65 |          | </txp:if_search_results>
     96.66 |          | [ ~~~ secondpass (2) ~~~ ]
     96.72 |     0.00 | [Callback_event: 'textpattern_end', step='', pre='0']

Offline

#6 2021-03-29 19:11:54

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

Re: Site Search

Mystery. The parser seems to enter the block, but outputs nothing, not even <txp:text />. Not even this html comment (assuming it’s still in your search_display form):

<!-- if search result count greater than 200 then display excessive results message, otherwise show search result count -->

And does outer <txp:if_search_results[-1]> not help?

Offline

#7 2021-03-29 19:29:31

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 108
Website

Re: Site Search

Well, that did it. What does the -1 do?

james

Offline

#8 2021-03-29 19:38:22

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

Re: Site Search

jrmartin wrote #329567:

Well, that did it. What does the -1 do?

It means this tag will be processed last, after <txp:article /> populating search results. But your tag trace does not explain why it did not work before.

Unless it was from your wife’s site?

Offline

#9 2021-03-29 19:42:09

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 108
Website

Re: Site Search

Yeah, the site has some odd things going on at times I can’t explain either. Thanks very much for your help in coming up with a solution. I’m off to fix my wife’s site now…

james

Offline

#10 2021-03-29 19:47:31

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

Re: Site Search

You are welcome, we are not fond of bugs in the wild, please don’t hesitate to report back.

Offline

#11 2021-03-29 20:12:18

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 108
Website

Re: Site Search

Just in case this is a bug, I used the same fix on Martha’s Italy and the version is the same, 4.8.4.

j

Last edited by jrmartin (2021-03-29 20:12:34)

Offline

#12 2021-03-29 20:29:52

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

Re: Site Search

jrmartin wrote #329572:

Just in case this is a bug

Can not tell for sure, you seem to be the first person it bites. Sometimes it is plugins interference, or an atypical server config.

If you have a chance to test

<txp:php>
    echo get_pref('secondpass', 1);
</txp:php>

in some article or form, that might help.

Offline

  1. Index
  2. » How?
  3. » Site Search

Board footer

Powered by FluxBB