Search code examples
searchsolrsubstringedismax

Substring matches within SOLR


I can't seem to figure out how to find substring matches with SOLR, I've figured out matches based on a prefix so I can get ham to match hamburger.

How would I get a search for 'burger' to match hamburger as well? I tried burger but this tossed an error '*' or '?' not allowed as first character in WildcardQuery.

How can I match substrings using SOLR?


Solution

  • You can enable this but it will be very resource hungry (e.g. search for SuffixQuery).

    See: http://lucene.472066.n3.nabble.com/Leading-Wildcard-Search-td522362.html

    Quoting the mailing list: Work arounds? Imagine making a second index (or adding another field) with all of the terms spelled backwards.

    =>

    See Add ReverseStringFilter https://issues.apache.org/jira/browse/LUCENE-1398

    and Support for efficient leading wildcards search: https://issues.apache.org/jira/browse/SOLR-1321

    At the moment issues.apache.org seems down. Try to use e.g. google cache.