--- On Thu, 1/6/11, lazymanc <moorhouse.p...@gmail.com> wrote: > From: lazymanc <moorhouse.p...@gmail.com> > Subject: Fuzzy search and field weighting/boosting > To: solr-user@lucene.apache.org > Date: Thursday, January 6, 2011, 5:12 PM > > I'm completely new to this but I've managed to set up a > Solr instance that is > pulling data from a MySql database. The records are > "artists" (e.g. bands, > performers, musicians, etc) with the following schema: > > <fields> > <field name="id" type="string" indexed="true" > stored="true" > required="true" /> > <field name="slug" type="string" indexed="false" > stored="true"/> > <field name="name" type="text" indexed="true" > stored="true"/> > <field name="alt_name" type="text" indexed="true" > stored="true"/> > <field name="created_at" type="date" > indexed="true" stored="true"/> > <field name="updated_at" type="date" > indexed="true" stored="true"/> > <field name="bio" type="text" indexed="false" > stored="true"/> > <field name="tour_name" type="text" > indexed="false" stored="false"/> > <field name="tour_desc" type="text" > indexed="false" stored="false"/> > > <field name="text" type="text" indexed="true" > stored="false" > multiValued="true"/> > <field name="text_rev" type="text_rev" > indexed="true" stored="false" > multiValued="true"/> > <dynamicField name="*" type="ignored" > multiValued="true" /> > </fields> > > <uniqueKey>id</uniqueKey> > <defaultSearchField>text</defaultSearchField> > <solrQueryParser defaultOperator="OR"/> > <copyField source="name" dest="text"/> > <copyField source="alt_name" dest="text"/> > <copyField source="bio" dest="text"/> > <copyField source="tour_name" dest="text"/> > <copyField source="tour_desc" dest="text"/> > > This was based on the example schema. > > What I want to do is perform a fuzzy search against the > dynamic "text" > field, but with an improved score for the name field, and > to a lesser extent > the alt_name field. > > So for example, if the search term is "Blak" then an artist > named "Black > Rebel Motorcycle Club" should rank higher than an artist > named "Anti Nowhere > League" but who has the word "Blake" in the bio field. > > Is this possible?
So, you want to use fuzzy query and boost matches in name field. You can remove catch-all field and use normal lucene query syntax: name:blak~^0.9 bio:blak~^0.2 should do it. By the way, fuzzy queries are not analyzed, so it is better to pre-lowercase them. May be you can use http://wiki.apache.org/solr/SpellCheckComponent instead of fuzzy queries. > I've read that you can do query-time > field boosting with > the DisMaxHandler, but that it doesn't support fuzzy > matching? It does not support fuzzy, wildcard queries. But Extended DisMax (edismax) said to be support full lucene query syntax.