Permalink
Browse files

Use Unicode properties for all letters and numbers, so nothing import…

…ant gets removed.
  • Loading branch information...
1 parent 95bb567 commit 5a5d2429185e3b007d7808816390b34f8d6cb3da @rogerbraun committed Apr 25, 2012
Showing with 6 additions and 6 deletions.
  1. +3 −3 generators/prototypes/all_in_one/sinatra/app.rb
  2. +3 −3 generators/prototypes/server/sinatra/app.rb
@@ -44,7 +44,7 @@ def each
#
books_index = Index.new :books do
source { Books.new }
- indexing removes_characters: /[^a-z0-9\s\/\-\_\:\"\&\.]/i,
+ indexing removes_characters: /[^\p{L}\p{N}\s\/\-\_\:\"\&\.]/i,
stopwords: /\b(and|the|of|it|in|for)\b/i,
splits_text_on: /[\s\/\-\_\:\"\&\/]/
category :title,
@@ -64,7 +64,7 @@ def each
#
books = Search.new books_index do
searching substitutes_characters_with: CharacterSubstituters::WestEuropean.new, # Normalizes special user input, Ä -> Ae, ñ -> n etc.
- removes_characters: /[^a-z0-9\s\/\-\_\&\.\"\~\*\:\,]/i, # Picky needs control chars *"~:, to pass through.
+ removes_characters: /[^\p{L}\p{N}\s\/\-\_\&\.\"\~\*\:\,]/i, # Picky needs control chars *"~:, to pass through.
stopwords: /\b(and|the|of|it|in|for)\b/i,
splits_text_on: /[\s\/\-\&]+/
@@ -129,4 +129,4 @@ def js path
end
-end
+end
@@ -31,7 +31,7 @@ def each
#
books_index = Index.new :books do
source { Books.new }
- indexing removes_characters: /[^a-z0-9\s\/\-\_\:\"\&\.]/i,
+ indexing removes_characters: /[^\p{L}\p{N}\s\/\-\_\:\"\&\.]/i,
stopwords: /\b(and|the|of|it|in|for)\b/i,
splits_text_on: /[\s\/\-\_\:\"\&\/]/
category :title,
@@ -51,7 +51,7 @@ def each
#
books = Search.new books_index do
searching substitutes_characters_with: CharacterSubstituters::WestEuropean.new, # Normalizes special user input, Ä -> Ae, ñ -> n etc.
- removes_characters: /[^a-z0-9\s\/\-\_\&\.\"\~\*\:\,]/i, # Picky needs control chars *"~:, to pass through.
+ removes_characters: /[^\p{L}\p{N}\s\/\-\_\&\.\"\~\*\:\,]/i, # Picky needs control chars *"~:, to pass through.
stopwords: /\b(and|the|of|it|in|for)\b/i,
splits_text_on: /[\s\/\-\&]+/
boost [:title, :author] => +3,
@@ -66,4 +66,4 @@ def each
results.to_json
end
-end
+end

0 comments on commit 5a5d242

Please sign in to comment.