简体   繁体   中英

sunspot solr query

in my rails app I use the following query:

@destinations = Destination.search do keywords params[:search], {:minimum_match => 1}

Let's assume that in the database are the following two destinations: "Berlin" and "Berliner Tor"

If I'm searching after "Berliner Tor" then only "Berliner Tor" is in the resultset. I'd like to have also "Berlin" in the resultset.

Has anyone an idea?

You can have the field you are searching on go through PorterStemFilterFactory.
PorterStemFilterFactory would reduce the terms to its roots and berliner is reduced to its root berlin.
This is enable the document with berlin term, being returned as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM