3
votes

I'm building a search engine with SOLR, and when an user searches for a phrase such as "apple", I get results such as:

Babyfood, apple ... apple, raw

I want "apple, raw" to appear ahead of "babyfood, apple" because the word apple appears in the front. Is there a way to do this with SOLR? To give more score to those results where the search term appears more in the front?

1
Why Solr returns "Babyfood" if you are searching for apple? are you using synonyms? So the question is: how to "de-boost" synonyms?! Could you please post a part of the schema.xml - the type definition of the fieldtype, where "apple" is part of? Something like ibm.com/developerworks/java/library/j-solr1 <- Listing 3The Bndr

1 Answers

-1
votes

try q=(field:apple*)^2 OR field:apple

where field is the name of the field against which you are searching