Order matters in my application because I'm indexing structured data - actually, a domain object model (a bit like with Hibernate Search), only I'm adding parents to children, instead of children to parents. So say I have Cities and People, with a 1-N relationship between City and People. I'm indexing documents for Cities, and documents for People, and the documents for People contain the fields of the City they're living in.

When I display the results, I'd like the People fields to display before the City fields. I can parse the Solr response and rearrange the fields (in the Java middle-tier, or with XSLT, or in the Javascript client), but then I have to "know" of the domain in too many places. I have to "know" of the domain in my Java application, in the SOLR schema file, and in the Javascript that rearranges the fields... I thought maybe I could avoid the latter and put as much application information as possible in the SOLR schema, for instance specifiy an order for the returned fields...

Thanks anyway,

Pierre

Erik Hatcher a écrit :
Yes, this is normal behavior.

Does order matter in your application?  Could you explain why?

Order is maintained with multiple values of the same field name, though - which is important.

    Erik


On Aug 17, 2008, at 6:38 PM, Pierre Auslaender wrote:

Hello,

After a Solr query, I always get the fields back in alphabetical order, no matter how I insert them.
Is this the normal behaviour?

This is when adding the document...
  <doc>
<field name="uid">ch.tsr.esg.domain.ProgramCollection[id: 1]</field>
      <field name="genre">collection</field>
      <field name="collection">Bac à sable</field>
<field name="collection.url">http://localhost:8080/esg/api/collections/1</field>
  </doc>

... and this is when retrieving it:
      <doc>
          <str name="collection">Bac à sable</str>
<str name="collection.url">http://localhost:8080/esg/api/collections/1</str>
          <str name="genre">collection</str>
<str name="uid">ch.tsr.esg.domain.ProgramCollection[id: 1]</str>
      </doc>

Thanks a lot,
Pierre Auslaender


Reply via email to