Page 1 of 1
Searchresults in list view
Posted: Sat Nov 14, 2009 2:00 pm
by onli
The listsearch-plugin provides an alternative way of displaying the searchresults. Instead of listing all the entries in full length, a list with excerpts is shown.

The output can be modified via smarty.
Garvin: Something like this don't exist yet? If that's true, shall I add this to spartacus?
Download:
http://www.onli-blogging.de/uploads/ser ... 1.1.tar.gz
Re: Searchresults in list view
Posted: Sat Nov 14, 2009 6:53 pm
by yellowled
onli wrote:Something like this don't exist yet? If that's true, shall I add this to spartacus?
I really like this, since it sets the search results page apart from the usual lists of entries, making it very clear to users that it actually
is a search results page.
Just to, you know, root for it a little
YL
Re: Searchresults in list view
Posted: Sun Nov 15, 2009 3:39 am
by Don Chambers
I have not looked at this plugin in detail.... But I think I would rather see a truncation option in the quicksearch plugin itself, rather than a separate plugin. Does that make any sense, or is it just not a good idea due to code?
Re: Searchresults in list view
Posted: Sun Nov 15, 2009 8:06 pm
by onli
Thanks Yellowled
@Don: The quicksearch-Plugin is only a sidebar-plugin, starting a search, and this search (part of the core) emits the entries as a whole. Changes to that would require a modification of core-functionality, of genpage.inc.php, and truncation of the entries via a function that also would need to be integrated into the core (at least that's the way as far as I can see). I didn't want to try that out without knowing that it would be added to the core.
Instead of that, the listsearch-sidebar-plugin points to an event-plugin, rendering the searchresults explicitly via smarty. I think that has its benefits.
But if Garvin thinks something like that should an can be added to the quicksearch-plugin: I would appreciate that (and also try to implement it).
Re: Searchresults in list view
Posted: Mon Nov 16, 2009 10:33 am
by garvinhicking
Hi!
Hm, tough decission. On the one hand, how to display search results to me is more a thing of templating, so that you would put a {if $view == 'search'}...{/if} into entries.tpl, or offer it as a template option.
On the other hand, since it might be useful to many, it might be good to offer it as a more central plugin. Adding it to spartacus for a so singular reason seems a bit bloated to me, another option would be to put it into an existing plugin like serendipity_event_customarchive and add a description like "custom search" to its title.
Putting it in the core wouldn't also be too bad, but I wonder what we do with people that don't install the quicksearch plguin because they use a template where the search button is implemented? Maybe it would be best to submit a hidden input field that tells the template view=short or view=full, so that anyone witha custom template could also emit that hidden config field...
Just throwing some ideas.
Regards,
Garvin
Re: Searchresults in list view
Posted: Mon Nov 16, 2009 11:21 am
by yellowled
garvinhicking wrote:Putting it in the core wouldn't also be too bad, but I wonder what we do with people that don't install the quicksearch plguin because they use a template where the search button is implemented?
I think there's also the issue that currently, this (I already tested it

) acts as a "second" quicksearch sidebar plugin, which might be confusing.
garvinhicking wrote:Maybe it would be best to submit a hidden input field that tells the template view=short or view=full, so that anyone witha custom template could also emit that hidden config field...
Just my two cents, but I like that idea
YL
Re: Searchresults in list view
Posted: Mon Nov 16, 2009 5:31 pm
by onli
Maybe it would be best to submit a hidden input field that tells the template view=short or view=full, so that anyone witha custom template could also emit that hidden config field...
Think that's a good idea. But it would mean that the event-plugin had to be installed - or would you really want to change genpage.inc.php for that?
Re: Searchresults in list view
Posted: Wed Mar 31, 2010 11:13 pm
by onli
Ok, I totally forgot about that
To answer myself, the change to genpage would be really small:
Code: Select all
diff -Nur serendipity-nightly/include/genpage.inc.php /var/www/include/genpage.inc.php
--- serendipity-nightly/include/genpage.inc.php 2009-05-28 10:34:52.000000000 +0200
+++ /var/www/include/genpage.inc.php 2010-03-31 23:06:23.000000000 +0200
@@ -98,7 +98,8 @@
$serendipity['smarty']->assign(
array(
'content_message' => sprintf(YOUR_SEARCH_RETURNED_BLAHBLAH, '<span class="searchterm">' . $serendipity['GET']['searchTerm'] . '</span>', '<span class="searchresults">' . serendipity_getTotalEntries() . '</span>'),
- 'searchresult_results' => true
+ 'searchresult_results' => true,
+ 'searchresult_fullentry' => $serendipity['GET']['fullentry']
)
);
given this change to the quicksearch-plugin:
Code: Select all
diff -Nur serendipity-nightly/include/plugin_internal.inc.php /var/www/include/plugin_internal.inc.php
--- serendipity-nightly/include/plugin_internal.inc.php 2010-01-13 13:28:55.000000000 +0100
+++ /var/www/include/plugin_internal.inc.php 2010-03-31 23:01:19.000000000 +0200
@@ -368,19 +368,37 @@
$propbag->add('description', SEARCH_FOR_ENTRY);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.0');
+ $propbag->add('version', '1.1');
+ $propbag->add('configuration', array('fullentry'));
$propbag->add('groups', array('FRONTEND_ENTRY_RELATED'));
}
+ function introspect_config_item($name, &$propbag)
+ {
+ switch($name) {
+ case 'fullentry':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', SEARCH_FULLENTRY);
+ $propbag->add('description', '');
+ $propbag->add('default', true);
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
+ $fullentry = serendipity_db_bool($this->get_config('fullentry', true));
?>
<form id="searchform" action="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>" method="get">
<div>
<input type="hidden" name="serendipity[action]" value="search" />
+ <input type="hidden" name="serendipity[fullentry]" value="<?php echo $fullentry ?>" />
<input alt="<?php echo QUICKSEARCH; ?>" type="text" id="serendipityQuickSearchTermField" name="serendipity[searchTerm]" size="13" />
<input class="quicksearch_submit" type="submit" value=">" alt="<?php echo QUICKSEARCH; ?>" name="serendipity[searchButton]" title="<?PHP echo GO; ?>" style="width: 2em;" />
</div>
With these changes, a template could react in the entries.tpl like this:
Code: Select all
{if $searchresult_results and not $searchresult_fullentry}
{$entry.body|strip_tags|truncate:200}
{else}
{$entry.body}
{/if}
It's a nice working solution, at least i think so, but it lacks a proper excerpt from the entry. Are there smarty-functions available which are a bit smarter than a simple truncate? Searchterms are marked anyway by serendipity_printEntries with a span-class...
Re: Searchresults in list view
Posted: Thu Apr 29, 2010 2:54 pm
by onli
Can this be committed or enhanced? Any comment?
Re: Searchresults in list view
Posted: Thu Apr 29, 2010 6:11 pm
by garvinhicking
Hi!
Yes! Pretty please. You do also have SVN access, right?
Regards,
Garvin
Re: Searchresults in list view
Posted: Thu Apr 29, 2010 7:41 pm
by onli
As far as I know, only for additional_plugins. Which is fine for me

Re: Searchresults in list view
Posted: Fri Apr 30, 2010 10:15 am
by garvinhicking
onli wrote:As far as I know, only for additional_plugins. Which is fine for me

Great, I committed it. Do you have a proposal for the language string "SEARCH_FULLENTRY"?
Regards,
Garvin
Re: Searchresults in list view
Posted: Fri Apr 30, 2010 11:06 am
by onli
"Show unshortened results" and german "Unverkürzte Ergebnisse anzeigen" would be my suggestion.
Re: Searchresults in list view
Posted: Fri Apr 30, 2010 11:14 am
by garvinhicking
Hi!
Hm, how about "Show full entry"? This is a bit broader, but we could maybe use this string for other things in the future?
(German: "Vollständigen Artikel zeigen")
Regards,
Garvin
Re: Searchresults in list view
Posted: Fri Apr 30, 2010 11:16 am
by onli
Fine with me
