From 386da18852328112788a70766b69217be8664b16 Mon Sep 17 00:00:00 2001 From: Josh French Date: Thu, 16 Jul 2009 18:38:16 -0400 Subject: [PATCH] README --- README | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/README b/README index 4e88fa0..22064cd 100644 --- a/README +++ b/README @@ -2,13 +2,16 @@ Adds ThinkingSphinx [http://ts.freelancing-gods.com/] support to Radiant. -== Usage +== Configuration -Requires the gem version of Thinking Sphinx, available at: +Requires gems for Thinking Sphinx and Will Paginate, available at: http://github.com/freelancing-god/thinking-sphinx -Once installed, add this line to environment.rb: +http://github.com/mislav/wil_paginate + +Once installed, add these lines to environment.rb: config.gem 'freelancing-god-thinking-sphinx', :lib => 'thinking_sphinx' + config.gem 'mislav-will_paginate', :lib => 'will_paginate' By default, only the first 8kB of any page's content will be indexed. You can change this in page_extensions.rb if that's not enough space, or if you wish @@ -21,6 +24,32 @@ searchable attribute from within the page edit view if you wish to restrict certain pages from appearing in the results -- just remember to call Page.search with +:conditions => { :searchable => 1 }+ if that's the case. +To configure the number of results returned per page, adjust the SearchPage's +@@per_page attribute. + +== Getting Search Results + +A Page subclass, SearchPage, is provided. This page will accept a +query+ param +and return any published page whose +searchable+ attribute is true. The following +Radius tags are available when building a SearchPage: + + * +results+ Opens the search results collection. Use +results:each+ to iterate + over them. + * +results:count+ The total (unpaginated) number of search results, appended + with the word "result" pluralized if appropriate. + * +results:current_page+ The current page of search results. + * +results:total_pages+ The total number of pages of search results. + * +results:query+ The original query. This is escaped for safe display. + * +results:each+ Iterator for the search result collection. + * +results:pagination+ Renders pagination links for the results collection. + Accepts optional +class+, +previous_label+, +next_label+, +inner_window+, + +outer_window+, and +separator+ attributes which will be forwarded to + WillPaginate's link renderer. + * +results:unless_query+ Expands if no query was present in the params. Useful + for alerting on blank GETs to a SearchPage. + * +results:if_empty+ Expands if the results collection was empty. Useful for + alerting users to broaden their search terms, for example. + ============================================================================== Copyright (c) 2008 Digital Pulp, Inc.