Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-05-10 10:05:54

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 261
Website GitHub GitLab Twitter

Blank search results

How to avoid many blank search results in my etymological dictionary?

An internal browser’s Ctrl-F search usually does not distinguishes diacritical from plain latin letters, finds and highlights all of them. That is OK, Textpattern also collects all the matching pages, but shows inexact excerpts as blank. For an example, there is only one page with dūš, although also many pages with dus.

How to exclude inexact results or at least cite them, too?

Offline

#2 2021-05-10 10:49:23

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

Re: Blank search results

A tough one. You can try to change collations of Title and Body(_html?) in textpattern table to utf8mb4_bin or something language-specific, but there is no guarantee. Backup, for sure.

Offline

#3 2021-05-10 13:47:58

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 261
Website GitHub GitLab Twitter

Re: Blank search results

Risked the change. And reverted back, in case of no difference between utf8mb4_bin and utf8mb4_lithuanian_ci.

Offline

#4 2021-05-10 14:26:37

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

Re: Blank search results

I have tried, but MySQL does not let me change Body collation because of FULLTEXT index.

A poor man solution might be hiding ‘parasite’ matches:

<txp:evaluate test="search_result_excerpt">
    ...
    <txp:search_result_excerpt />
    ...
</txp:evaluate>

Offline

#5 2021-05-10 15:15:59

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 261
Website GitHub GitLab Twitter

Re: Blank search results

Good catch, thanks Oleg, that should work. I still have not adjusted tags correctly, though — that is all I have been able to do:

<txp:article> <txp:evaluate test="search_result_excerpt">
	<section><txp:permlink>
		<h3><txp:section title />: <txp:title /></h3>
		<p><txp:search_result_excerpt /></p>
	</txp:permlink></section>
</txp:evaluate> </txp:article>

Unfortunately, no articles are shown now in the search results.

Offline

#6 2021-05-10 15:23:09

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

Re: Blank search results

Tests are done only one-level depth, so it could be (untested though)

<txp:article>
    <txp:permlink evaluate="search_result_excerpt" wraptag="section">
		<h3><txp:section title />: <txp:title /></h3>
		<p><txp:search_result_excerpt /></p>
    </txp:permlink>
</txp:article>

Edit: otherwise,

SELECT 'dūš' LIKE 'dus' COLLATE utf8mb4_bin

returns 0 for me, unlike

SELECT 'dūš' LIKE 'dus'

So, if you manage to change Body collation to utf8mb4_bin (or something else without _ci suffix, i.e. not case-insensitive), that could work.

Offline

#7 2021-05-10 18:21:39

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 261
Website GitHub GitLab Twitter

Re: Blank search results

Bingo! Your txp:tag_fu beats every ghost and fake news now, thanx!

Offline

#8 2021-05-10 18:31:40

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 261
Website GitHub GitLab Twitter

Re: Blank search results

Oops, the ghosts are still live, although they are hidden from our readers as an empty <a rel="bookmark" href="https://domain.tld/titile"></a> now.

Last edited by Vienuolis (2021-05-10 18:32:10)

Offline

#9 2021-05-10 19:48:51

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

Re: Blank search results

Vienuolis wrote #330100:

Oops, the ghosts are still live, although they are hidden from our readers as an empty <a rel="bookmark" href="https://domain.tld/titile"></a> now.

Damn! Ok, this will be for 4.8.6. Meanwhile,

<txp:article>
    <txp:permlink wraptag="section"><txp:evaluate test="search_result_excerpt">
		<h3><txp:section title />: <txp:title /></h3>
		<p><txp:search_result_excerpt /></p>
    </txp:evaluate></txp:permlink>
</txp:article>

Offline

Board footer

Powered by FluxBB