Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-08 01:11:20

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

search_result_excerpt 'limit' attribute

Can someone clarify the workings of the limit attribute in <txp:search_result_excerpt />? I suspect that Textbook is not quite correct, or is it? I’ve always thought that it determined the maximum number of highlighted matches in a search result excerpt, but now that I’m checking that on my site, it doesn’t seem to be the case, I’m not using the limit attribute so it should return it’s default value of 5 matches maximum, but if there are more it displays more (but not all)…

Offline

#2 2009-03-08 02:25:20

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: search_result_excerpt 'limit' attribute

The code, as I understand it, uses the value of $limit to set the maximum returned article body excerpts or segments matched and truncated within a returned result, hilighting is done by regular expression after the return value is defined (there can be more than 5 hilights because more than one search term match can exist within the 50 char spans of the excerpt).

The number of returned search results is set by the article $limit value, given that it is used in an article form.

Textbook is, in fact, correct though I might consider revising the wording for hilight to:

HTML tag to be used for search term matches in excerpt text, without brackets. “

And limit to:

“Maximum number of search match excerpts per search result.”

Last edited by rsilletti (2009-03-08 02:29:50)

Offline

#3 2009-03-08 08:46:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,821
Website GitHub

Re: search_result_excerpt 'limit' attribute

rsilletti wrote:

Textbook is, in fact, correct though I might consider revising the wording…

Done.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2009-03-08 14:20:02

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: search_result_excerpt 'limit' attribute

rsilletti wrote:

The code, as I understand it, uses the value of $limit to set the maximum returned article body excerpts or segments matched and truncated within a returned result

Ah, that makes it very clear, thanks Rick!

Bloke wrote:

Done.

You beat me to it. That was why I was asking… Thanks :)

Offline

Board footer

Powered by FluxBB