I'm having trouble with sorting -- things don't return in the order
that I think they should. To look into this problem further, I thought
I'd query solr and try to display the data field in question. I tried
forming my own URL but solr wasn't returning my field. Then I tried
the admin form in case I was formatting my URL incorrectly ... still
no dice. The default on the admin form looks to return all fields plus
score. However, I only get a few fields back (pk_i, id, and score). So
... I was wondering, where are my other fields and is there a way I
can see them? I'm sure they're being saved since I can do searches
against them. Here's the XML for creating one of them (I'm using
acts_as_solr for Ruby on Rails for this):

<doc>
  <field name="type_t"></field>
  <field name="pk_i">1</field>
  <field name="id">BaseAsset:1</field>
  <field name="asset_id_t" boost="1.0">1</field>
  <field name="text_for_solr_t" boost="1.0">This is a photo of a field
at sunset.</field>
  <field name="name_for_sort_t" boost="1.0">simple photo.jpg</field>
  <field name="security_level_t" boost="1.0">1</field>
  <field name="media_type_for_solr_t" boost="1.0">Images</field>
</doc>

The pk_i and id fields are coming through okay -- but the others are
not. Could it be related to the boost that's on those fields?

Anyway, this is just to help me with troubleshooting ... the main
issue is that sorting of results isn't working. For example, I've
created a field called name_for_sort (which is just the name but all
lower-case) that I want to sort. When I try either of these URLs, I
get the name in all sorts of order, but not alpha order which is what
I expect (non-URL encoded to make it easier to read, but I've tried
submitting it URL-encoded:

http://localhost:8982/solr/select?qt=standard&q=(photo) AND
type_t:BaseAsset&fl=*,score&wt=ruby&sort=name_for_solr_t asc

The very strange thing is that when I make up a field name for sort it
doesn't complain, but if I omit the _t at the end, it complains that
the field doesn't exist.

Anyway, any light anyone can shine on this would be greatly appreciated! Thanks!

Reply via email to