You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Hayden Muhl <hm...@popsugar.com> on 2014/03/03 21:00:17 UTC

Wildcard searches and tokenization

I'm working on a user name autocomplete feature, and am having some issues
with the way we are tokenizing user names.

We're using the StandardTokenizerFactory to tokenize user names, so
"foo-bar" gets split into two tokens. We take input from the user and use
it as a prefix to search on the user name. This means wildcard searches of
"fo*" and "ba*" both return "foo-bar", which is what we want.

We have a problem when someone types in "foo-b" as a prefix. I would like
to split this into "foo" and "b", then use each as a prefix in a wildcard
search. Is there an easy way to tell Solr, "Tokenize this, then do a prefix
search"?

I've written at least one QParserPlugin, so that's an option. Hopefully
there's an easier way I'm unaware of.

- Hayden