q="This is a sample string"^10 (This is a sample string)^5 fuzzy:(This is a sample string)
You'd have to define the 'fuzzy' field as an EdgeNGram field, such that 'sample' gets indexed as: s sa sam samp sampl sample Obviously, that'll take more space in your index, but I believe it would get you the result you want. Thus, exact phrase matches are boosted 10, docs that contain some of the words are boosted 5, and fuzzy matches effectively get a boost of 1 (the default). Upayavira On Mon, Jun 17, 2013, at 08:46 AM, Daniel Mosesson wrote: > What I am looking to do is take field that contains a string like (called > name for example): > > "This is a sample string" > > and then query by that field so that a search for "This" gets x points > (exact match), "sam" gets y points (partial match). > > I attempted to do this via the sort and query parameters, like so: > > sort=if(name==This,100,50) but this gives me an error: > sort param could not be parsed as a query, and is not a field that exists > in the index: if(name==This,100,50) > > Full URL: > http://localhost:8983/solr/db/select?q=name%3A*&sort=if(name%3D%3D%22This%22%2C100%2C50)+asc&fl=price%2Cname&wt=xml&indent=true > > Is there a way to do this? > > Note: I believe that I can at least get the documents that need to be > sorted via (name:This AND name:This*) but then I do not know where to go > from there (as I can't seem to get sort working for any functions). > > Can anyone provide some examples for how to do this kind of thing? > > Thank you. > > ________________________________ > > ****************************************************************** > This e-mail message and any attachments are confidential. Dissemination, > distribution or copying of this e-mail or any attachments by anyone other > than the intended recipient is prohibited. If you are not the intended > recipient, please notify Ipreo immediately by replying to this e-mail, > and destroy all copies of this e-mail and any attachments. Thank you! > ******************************************************************