Skip to content

Commit

Permalink
+ improved generated app descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Mar 18, 2011
1 parent ebb7013 commit 714370d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions generators/prototypes/client/sinatra/app.rb
Expand Up @@ -6,17 +6,16 @@
#
require File.expand_path 'book', File.dirname(__FILE__)

set :haml, { :format => :html5 }

# Sets up a search instance to the server.
#
BookSearch = Picky::Client.new :host => 'localhost', :port => 8080, :path => '/books'

set :static, true
set :public, File.dirname(__FILE__)
set :views, File.expand_path('views', File.dirname(__FILE__))
set :haml, :format => :html5

# Root, the search interface.
# Root, the search page.
#
get '/' do
@query = params[:q]
Expand Down
9 changes: 4 additions & 5 deletions generators/prototypes/server/unicorn/app/application.rb
Expand Up @@ -20,10 +20,10 @@ class PickySearch < Application
stopwords: /\b(and|the|of|it|in|for)\b/,
splits_text_on: /[\s\/\-\,\&]+/,

maximum_tokens: 5, # Amount of tokens passing into a query (5 = default).
maximum_tokens: 5, # Amount of tokens used in a search (5 = default).
substitutes_characters_with: CharacterSubstituters::WestEuropean.new # Normalizes special user input, Ä -> Ae, ñ -> n etc.

# Define an index. Use a database etc. source? Use an in-memory index or Redis?
# Define an index, Index::Memory or Index::Redis.
# See http://github.com/floere/picky/wiki/Sources-Configuration#sources
#
books_index = Index::Memory.new :books, Sources::CSV.new(:title, :author, :year, file: 'app/library.csv')
Expand All @@ -34,10 +34,9 @@ class PickySearch < Application
books_index.define_category :author,
partial: Partial::Substring.new(from: 1)
books_index.define_category :year,
partial: Partial::None.new # Partial substring searching on the year does not make
# much sense, neither does similarity.
partial: Partial::None.new

options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # +/- points for combinations.
options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # Combination boosting.

route %r{\A/books\Z} => Search.new(books_index, options)

Expand Down

0 comments on commit 714370d

Please sign in to comment.