We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Excerpt

Development and Programming

Daniel Walton's avatar
Daniel Walton
553 posts
17 years ago
Daniel Walton's avatar Daniel Walton

It certainly should Ryan, I will delve into this query when I get home and update the thread accordingly 😊

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

Thanks, that would be great. This plugin will make me look like a hero. :cheese:

       
Daniel Walton's avatar
Daniel Walton
553 posts
17 years ago
Daniel Walton's avatar Daniel Walton

This plugin has been updated to version 1.0.3.

Changelog: - Fixed - Fixed a problem where certain parameter values could have no effect. - Fixed - Shouldn’t interfere with other code utilising the cache. - Fixed - Chunk creation should be a little faster. - Fixed - Fixed an issue where some wrapping tags could break the return string. - Added - Now checks are made against some safe ‘wrapping’ tags for parameter input. - Added - Added some default variables as class properties (nearer the top) for easier editing should it be required - Fixed - Fixed a localisation problem causing no return output. - Fixed - Fixed an issue where paginated search result would return the complete unparsed input.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

This thing is good. Thanks for sending along a “beta” before this release so I could get my project out the door.

       
fitzage's avatar
fitzage
100 posts
17 years ago
fitzage's avatar fitzage

This seems to only be working correctly with single word searches. If I try doing a search with multiple words, even if I choose exact phrase, I get oodles of unrelated chunks. Is that because the plugin doesn’t realize I want the exact phrase so it’s just putting chunks that contain any of the words? I can’t very well depend on my users to only search for a single word.

Also, when I do search for a single word, some of the results come back displaying no chunks, whereas some are just fine.

       
Daniel Walton's avatar
Daniel Walton
553 posts
17 years ago
Daniel Walton's avatar Daniel Walton

Hi Fitzage,

The plugin is only set up to search for single words, so supplying a multiple word search will highlight whether exact phrase or not. The reason is because there is no way to tell what type of search was made. Because EE will return only relevant search results though it seemed reasonable for this behaviour.

As for no matches that could be because the search has found your search term in a custom field that isn’t between the plugin tags?

       
fitzage's avatar
fitzage
100 posts
17 years ago
fitzage's avatar fitzage

Well, the no results thing is weird because I checked the articles in question and they had oodles of results.

As far as the rest goes, I can’t really use the plugin if it’s going to search individually for every word in a phrase, because you can’t prevent people from typing phrases that include very small and common words.

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore
Hi Fitzage, The plugin is only set up to search for single words, so supplying a multiple word search will highlight whether exact phrase or not. The reason is because there is no way to tell what type of search was made. Because EE will return only relevant search results though it seemed reasonable for this behaviour. As for no matches that could be because the search has found your search term in a custom field that isn’t between the plugin tags?

Hi Daniel,

I was going to ask the same question that fitzage asked. When searching for a single word, the plugin works great. When searching for a phrase with multiple words, I still get relevant results but nothing is highlighted in the search results. I would expect that the whole phrase would be highlighted (if it matches of course) or if nothing else, any word matching any of those in the search query would be highlighted?

In your response above you said:

so supplying a multiple word search will highlight whether exact phrase or not

Am I understanding that correctly in that a multiple word search should still highlight the exact phrase (if found) or single words from the search?

       
TPE's avatar
TPE
99 posts
16 years ago
TPE's avatar TPE

Really great plug in, having problems with the following tag:

{exp:zm_excerpt chunk_wrap="none" pre_chars="5" post_chars="5" chunk_prepend="..." chunks="1"}

Gives me “Notice: Array to string conversion in /usr/local/pem/vhosts/103582/webspace/httpdocs/tru-vue_system/plugins/pi.zm_excerpt.php on line 281 Notice: Array to string conversion in /usr/local/pem/vhosts/103582/webspace/httpdocs/tru-vue_system/plugins/pi.zm_excerpt.php on line 289” for each search result…

Removing the pre and post chars fixes the error, (I tried numbers besides 5, including 50 and 100)

Also, still get a span tag despite the “none” even when using

{exp:zm_excerpt chunk_wrap="none" chunks="1"}

though it causes no problems so I don’t really worry about it…

Thanks for your time…

       
lithiumdave's avatar
lithiumdave
215 posts
16 years ago
lithiumdave's avatar lithiumdave

Excerpt is an excellent plugin, thanks. Just wondering: I’m finding that if the search terms don’t appear in my designated custom field, then it seems nothing at all is returned. Is that correct? I’d like that if the search terms don’t appear then at least the excerpt of the field would be displayed as per the default behaviour of exp:search_results.

Does anyone know if that’s correct and if so how can I avoid having no results returned in this case?

Many thanks.

       
Daniel Walton's avatar
Daniel Walton
553 posts
16 years ago
Daniel Walton's avatar Daniel Walton

That is correct. Why don’t you include all fields?

       
lithiumdave's avatar
lithiumdave
215 posts
16 years ago
lithiumdave's avatar lithiumdave

Hi Daniel - I’m not sure how you mean? Could you give me an example? Currently I have this in my search results template:

{exp:zm_excerpt output_wrap="p"}{full_text}{/exp:zm_excerpt}

Thanks for your help.

       
lithiumdave's avatar
lithiumdave
215 posts
16 years ago
lithiumdave's avatar lithiumdave

Ah! You mean I can put regular custom fields in there too?! If that’s what you mean, I really did not know that! Wow!!!

If you mean something else then let me know, but otherwise I’m sorted 😊

       
lithiumdave's avatar
lithiumdave
215 posts
16 years ago
lithiumdave's avatar lithiumdave

Just to be sure, do you mean simply place every custom field I want to include in the search result, one after the other, like this?

{exp:zm_excerpt output_wrap="p"}{custom_field_1}{custom_field_2}{custom_field_3}{custom_field_4}{custom_field_5}..{/exp:zm_excerpt}

Just so I’m not missing a trick.

       
Daniel Walton's avatar
Daniel Walton
553 posts
16 years ago
Daniel Walton's avatar Daniel Walton

Hi Dave,

That is precisely what I meant 😊

       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.