Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-03-21 23:10:16
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Search output wrapps w/strong element allso for strings inside words
It seems like Textpattern mistakenly wrapps query strings even inside words as a string /part of that word (v4.03).
for the returned search query.
Is this default behavior for search output?
I believe that this is a bug, but just out of curiosity i first post here.
The problem here is not with the search result, but with the way the query term gets wrapped up in the result.
<h2>Example for a query for the term “in”</h2>
<code><h3><a href=“http://consking.com/article/first-post” title=“Permanent link to this article”>First Post</a></h3>
<p>… ipsum dolor sit amet, consectetuer adipisc<strong >in</strong>g elit. Donec rutrum est eu mauris. <strong>In</strong> volutpat … ad litora torquent per conubia nostra, per <strong>in</strong>ceptos hymenaeos. Quisque sed arcu. Aenean purus … at, commodo sit amet, turpis. Aenean lacus. Ut <strong>in</strong> justo. Ut viverra dui vel ante. Duis imperdiet … Duis id orci non magna rutrum bibendum. Mauris t<strong>in</strong>cidunt, massa <strong>in</strong> rhoncus consectetuer, lectus dui …<br/>
<small><a href=“http://consking.com/article/first-post” title=“Permanent link to this article”>http://consking.com/article/first-post</a> ·
9 days ago</small></p><h3><a href=“http://consking.com/article/in-search-for-one-true-primary-navigation-tag” title=“Permanent link to this article”>In search for one true primary navigation tag</a></h3></code>
<h2>will display result in something like that:</h2>
<h3><a href=“http://consking.com/article/first-post” title=“Permanent link to this article”>First Post</a></h3>
<p>… ipsum dolor sit amet, consectetuer adipisc<strong>in</strong>g elit. Donec rutrum est eu mauris. <strong>In</strong> volutpat … ad litora torquent per conubia nostra, per <strong>in</strong>ceptos hymenaeos. Quisque sed arcu. Aenean purus … at, commodo sit amet, turpis. Aenean lacus. Ut <strong>in</strong> justo. Ut viverra dui vel ante. Duis imperdiet … Duis id orci non magna rutrum bibendum. Mauris t<strong>in</strong>cidunt, massa <strong>in</strong> rhoncus consectetuer, lectus dui …<br/>
<small><a href=“http://consking.com/article/first-post” title=“Permanent link to this article”>http://consking.com/article/first-post</a> ·
9 days ago</small></p><h3><a href=“http://consking.com/article/in-search-for-one-true-primary-navigation-tag” title=“Permanent link to this article”>In search for one true primary navigation tag</a></h3>
The problem with this for me is , that I have a special style applied to all strong elements, and the results would rather like silly the way it is.
regards, marios
Last edited by marios (2006-03-21 23:22:54)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#2 2006-03-22 00:03:43
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Search output wrapps w/strong element allso for strings inside words
Textpattern does match partial words in search results, so the hilighted portions are accurate.
You could wrap your search results in a div to avoid the style problem.
Alex
Offline
#3 2006-03-22 00:39:11
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Search output wrapps w/strong element allso for strings inside words
Can I change the partial match to word match in taghandlers ?
(I allso prefer the highlighting as is)
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#4 2006-03-22 00:53:25
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Search output wrapps w/strong element allso for strings inside words
Can I change the partial match to word match in taghandlers ?
Of course. This is open source, change what you like.
Alex
Offline
#5 2006-03-22 01:24:06
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Search output wrapps w/strong element allso for strings inside words
Ok, if I wanted to change it then, I assume that the result is stored in $result in publish , but where does it get truncated ?
Is my guess right that, if I change the regular expression for the preg_match_all function,would do it ?
EDIT.:It would take me quite some time to figure this out on my own so that’s why I am asking you.
regards, marios
Last edited by marios (2006-03-22 01:35:32)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#6 2006-03-22 01:40:27
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Search output wrapps w/strong element allso for strings inside words
The behaviour of the search_excerpt tag is governed by the search_excerpt tag handler.
Alex
Offline
#7 2006-03-22 01:59:38
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Search output wrapps w/strong element allso for strings inside words
Ok, I was wandering in the dark it seems, that should point me in the right direction,
Ah and zem,before I forget it , thanks for the programming tutorials, they’re really nicely written,
I have to catch up on those as well it seems,
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline