I think this can be achieved by boosting the fields and then sorting by the score.

http://wiki.apache.org/solr/SolrRelevancyFAQ#Field_Based_Boosting

On 02/26/2013 01:55 PM, David Philip wrote:
Hi Team,

    Is it possible to get search results  in the order of fields names set?

Ex: say,

    - I have 3 fields : Author, Editors, Raw_text,
    - User searched for keyword: "John Hopkins",
    - Search query is : q= (Author: "John Hopkins" OR Editors:"John Hopkins"
    OR Raw_Text:"John Hopkins")

Expected result:
Result should be returned such that it should first get all the documents
which had "John hopkins" in field author and then the documents which had
"John Hopkins" in Editors and then in documents which had John Hopkins in
Raw_text. So if keyword is there in the main field author, it should get
that document first followed by editor and raw text.


  <result name="response" numFound="3" start="0">
<doc>
<str name="Author">John Hopkins</str>
<str name="Editors">test test test</str>
<str name="Raw_text">Mr. John Hopkins book</str>
</doc>
<doc>
<str name="Author">Micheal Ranold</str>
<str name="Editors">John Hopkins, Micheal, Martin</str>
<str name="Raw_text">Micheal is the main author, John Hopkins is co-author
</str>
</doc>
<doc>
<str name="Author">Feymenn</str>
<str name="Editors">Micheal, Martin</str>
<str name="Raw_text">John Hopkins</str>
</doc>
</result>


--
Oussama Jilal

Reply via email to