The Solr schema.xml has by default the “string” fieldType.
Add the following fieldType to your schema.xml and use it as field type for your field:
As example we take the index value “john doe”. By default Solr doesn’t support a wildcard at the begin of the term like “*doe”, only “doe*”. But it is possible to achieve this by using the solr.ReversedWildcardFilterFactory filter.
But we still have one problem left. Wildcard search on two words isn’t possible. This can be fixed to remove all whitespaces. Pass the value “John Doe” at indexing time to Solr and it will be stored as “John Doe”, but indexed as “johndoe” because of the solr.PatternReplaceFilterFactory filter. At query time, search without spaces and in lowercase like “*hndo*” and it will match!
Please note that with wildcard queries analyzers are not supplied, so make sure your search term is already in lowercase. Also make sure that you search as term and NOT as phrase with double quotes around it.