Let's say I have a class Item that has a collection of Sell objects.
Sell objects have two properties sellingTime (Date) and salesPerson
(String).
So in my Solr schema I have something like the following fields defined:

<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="sellingTime" type="date" indexed="true" stored="false"
multiValued="true" />
<field name="salesPerson" type="text" indexed="true" stored="false"
multiValued="true" />

An add might look like the following:

<add>
  <doc>
    <field name="id">1</field>
    <field name="sellingTime">2007-11-23T23:01:00Z</field>
    <field name="salesPerson">John Doe</field>
  </doc>
  <doc>
    <field name="id">2</field>
    <field name="sellingTime">2007-12-24T01:15:00Z</field>
    <field name="salesPerson">John Doe</field>
    <field name="sellingTime">2007-11-23T21:11:00Z</field>
    <field name="salesPerson">Jack Smith</field>
  </doc>
</add>


My problem is that all the historical sales data for the items are
getting flattened out.
I need the sellingTime and salesPerson fields to be kept as a pair
somehow, but I need to store the data as a seperate date field so that
I can do range searches.

Specifically I want to be able to do the following search:
salesPerson:"John Doe" AND sellingTime:[2007-11-23T00:0:00Z TO
2007-11-24T00:00:00Z]
Right now that query would return both items 1 and 2, but I want it to
only return item 1.

Is there some trick to get this query to work as I want it to?  Or do
I need to totally restructure my data?

Reply via email to