# Ferret wildcard search

**URL:** <https://www.ruby-forum.com/t/ferret-wildcard-search/146371>\
**Category:** Ferret\
**Created:** [August 20, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/ferret-wildcard-search/146371 "2008-08-20T12:06:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joschy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a587f6/32.png) [@joschy](https://www.ruby-forum.com/u/joschy)\
**Post date:** [August 20, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/ferret-wildcard-search/146371/1 "2008-08-20T12:06:00Z")

</div>

Hello community,

using ferret 0.11.5 under Win2003 Server i got the following error:

Searching: “ZÃ¼rich” works fine  
Searching: “Zuerich\*” works fine  
Searching: “ZÃ¼rich\*” returns 0 results

Every “Umlaut” like “Ã¼Ã¤” including a wildcard leads to zero results.

I am exporting data from an UTF8 database to a ferret index. Everything  
works fine, except the shown problem. Tried also different  
Ferret.locales - same result.

Thank you very much for every help,  
Joschy

require ‘ferret’  
require ‘active\_record’  
require ‘yaml’  
require ‘iconv’  
include Ferret

class User \< ActiveRecord::Base  
end

#database with UTF8-general, search user  
db\_config =  
YAML::load(File.open(“D:/XamppApps/Project.AddressBook/AddressBookWeb/config/database.yml”))  
ActiveRecord::Base.establish\_connection(db\_config[“service”])  
user = User.find(:first, :conditions =\> [‘uid= ?’, ‘jschneid’])

#create new ferret index  
field\_infos = Index::FieldInfos.new()  
field\_infos.create\_index(“D:/XamppApps/Project.AddressBook/AddressBookWeb/index2”)

#create new ferret index  
ferret\_configuration = {  
:path =\>  
“D:/XamppApps/Project.AddressBook/AddressBookWeb/index2”,  
:handle\_parse\_errors =\> true,  
:default\_search\_field =\> ‘\*’,  
:analyzer =\> Analysis::StandardAnalyzer.new,  
:wild\_lower =\> true  
}

index = Index::Index.new(ferret\_configuration)

#update index  
doc = Hash.new(user.id)  
doc[‘city’] = user.city  
doc[‘uid’] = user.uid

index \<\< doc  
index.flush

#result: OK  
value = “ZÃ¼rich”  
value = Iconv.conv(‘utf-8’, ‘ISO-8859-1’, value)  
puts (index.search(value).total\_hits)

#result: 0 -\> error  
value = “ZÃ¼rich\*”  
value = Iconv.conv(‘utf-8’, ‘ISO-8859-1’, value)  
puts (index.search(value).total\_hits)
