lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Abraham" <george.abraham.luc...@gmail.com>
Subject return only sorted Field, but with a different Field Name
Date Mon, 10 Mar 2008 13:22:13 GMT
Hi all,
Sorry if this is a easy one, but apparently my research isn't working for
now. Here is what I want to do.

Currently I index the contents of my database using Solr. After a search
result is retrieved from Solr, I extract only the key fields that I need
(mostly the unique ID and score) and then match it with the permissions in
the database before I present it to a user. I have a tonne of dynamic fields
in the index, and sometimes I want to sort by them. That is easy enough.

For example, say I want to sort by the field '162_sortable_s' then I add a
parameter like so 'sort=162_sortable_s.' I need to change the settings so
that when the result set is returned from solr, it takes the values of
'162_sortable_s' and inserts them into a separate field called 'SortedField'
so that the return doc looks like this:

<response>
<lst name="responseHeader">
 <int name="status">0</int>
 <int name="QTime">0</int>
 <lst name="params">
  <str name="explainOther"/>
  <str name="fl">*,score</str>
  <str name="debugQuery">on</str>
  <str name="sort">162_sortable_s desc</str>
  <str name="indent">on</str>
  <str name="start">0</str>
  <str name="q">chouchin</str>
  <str name="hl.fl"/>
  <str name="qt">standard</str>
  <str name="wt">standard</str>
  <str name="rows">10</str>
  <str name="version">2.2</str>
 </lst>
</lst>
<result name="response" numFound="3" start="0" maxScore="2.5168622">
<doc>
  <float name="score">2.075873</float>
  <str name="SortedField">Brecher, Henry</str>
  <str name="ItemID">4077f1ed-6885-4170-badc-c72816d5b473</str>
</doc>
<doc>
  <float name="score">2.075873</float>
  <str name="SortedField">Charles, Tom</str>
  <str name="ItemID">951ecbc9-0cd6-4ba5-b32f-e5d6bc42ce29</str>
</doc>
 <doc>
  <float name="score">2.5168622</float>
  <str name="SortedField">Zeke</str>
  <str name="ItemID">530760aa-bf25-4f74-ab8b-caca744b9362</str>
</doc>
</result>
</response>


How or where do I change that setting? Do I have to rewrite some part of the
RequestHandler?

Thanks,
George

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message