jfahrenkrug / radiant-xapian-search-extension forked from digitalpulp/radiant-sphinx-search-extension
- Source
- Commits
- Network (3)
- Downloads (1)
- Wiki (1)
- Graphs
-
Tree:
06ce74d
tree c89819134ff1f66f070575d81e69af335f71cde0
parent d6e5829714ef0df7cf79da85856cf1cc153e2672
| name | age | message | |
|---|---|---|---|
| |
README.md | Wed Jul 29 08:12:00 -0700 2009 | |
| |
Rakefile | Tue May 26 02:49:16 -0700 2009 | |
| |
app/ | ||
| |
db/ | ||
| |
lib/ | ||
| |
spec/ | Wed Jul 29 08:12:00 -0700 2009 | |
| |
xapian_search_extension.rb |
Xapian Search Extension for Radiant
Adds Xapit support to Radiant.
Installation
First, you'll need to install Xapian.
Next - from the root of your Radiant app - install the Xapit Plugin:
git submodule add git://github.com/ryanb/xapit.git vendor/plugins/xapit
mkdir config/initializers
cp vendor/plugins/xapit/rails_generators/xapit/templates/setup_xapit.rb config/initializers
Finally, install the extension:
git submodule add git://github.com/jfahrenkrug/radiant-xapian-search-extension.git vendor/extensions/xapian_search
And run the migration:
rake radiant:extensions:xapian_search:migrate
Usage
Now you can call the search method on the Page class:
Page.search("Yak Shaving")
It has built-in pagination. For more details and options, see the Xapit Readme.
The extension adds a "Searchable" checkbox to the Page admin form so you can define whether a page gets added to the index or not. Please note that the index is not being updated automatically! You'll have to call
rake xapit:index
from a cron job regularly or use something like Xapit-Sync.
Page Type and Tags
This extension should work as a drop-in replacement for the Radiant Search Extension. So the instructions below and 99% of the search_page.rb code come from that extension. Thank you, guys!
Installation:
This extension works by creating a new page type called "Search". After you install it and re-start your web server, you should have a new type of page available.
- Download and install according to the instructions above.
- Create a new page called "Search" (or whatever you want)
- Set the Page Type to "Search" and the Status to "Published"
- Take the sample code below and paste it into the body of the new page.
- Visit http://localhost:3000/search and enter a search term.
- Bask in the glow of a job well done. :)
Example:
Place everything in the block below in the body of the "Search" page. This will provide a very basic Search page, but it should show you everything you need to know to make your own page better.
<r:search:form submit="Search"/>
<r:search:initial>
<strong>Enter a phrase above to search this website.</strong>
</r:search:initial>
<r:search:empty>
<strong>I couldn't find anything named "<r:search:query/>".</strong>
</r:search:empty>
<r:search:results>
Found the following pages that contain "<r:search:query/>".
<ul>
<r:search:results:each>
<li><r:link/><br/>
<r:search:highlight><r:content/></r:search:highlight></li>
</r:search:results:each>
</ul>
</r:search:results>
Inspired by the sphinx_search_extension by Digital Pulp.
In 2009 by Johannes Fahrenkrug, Springenwerk

