Thanks so much Otis. This is working great.

Now, I'm trying to make facets on pictures: display doc w/ pic vs. doc w/o pic

To the best of my knowledge, everyone is saying that faceting cannot be done on 
dynamic fields (only on definitive field names). Thus, I tried the following 
and it's working: I assume that the stored pictures have a sequential number 
(_1, _2, etc.), i.e., if pic_url_1 exists in the index, it means that the 
underlying doc has at least one picture: 

...&facet=on&facet.field=pic_url_1&facet.mincount=1&fq=pic_url_1:*

While this is working fine, I'm wondering whether there's a cleaner way to do 
the same thing without assuming that pictures have a sequential number.

Also, do you have any documentation about handling Dynamic Fields using SolrJ. 
So far, I found only issues about that on JIRA, but no documentation.

Thanks a lot.

-Saïd

On Jun 26, 2010, at 1:18 AM, Otis Gospodnetic wrote:

> Saïd,
> 
> Dynamic fields could help here, for example imagine a doc with:
> id
> pic_url_*
> pic_caption_*
> pic_description_*
> 
> See http://wiki.apache.org/solr/SchemaXml#Dynamic_fields
> 
> So, for you:
> 
> <dynamicField name="pic_url_*"  type="string"  indexed="true"  stored="true"/>
> <dynamicField name="pic_caption_*"  type="text"  indexed="true"  
> stored="true"/>
> <dynamicField name="pic_description_*"  type="text"  indexed="true"  
> stored="true"/>
> 
> Then you can add docs with unlimited number of 
> pic_(url|caption|description)_* fields, e.g.
> 
> id
> pic_url_1
> pic_caption_1
> pic_description_1
> 
> id
> pic_url_2
> pic_caption_2
> pic_description_2
> 
> 
> Otis
> ----
> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
> Lucene ecosystem search :: http://search-lucene.com/
> 
> 
> 
> ----- Original Message ----
>> From: Saïd Radhouani <r.steve....@gmail.com>
>> To: solr-user@lucene.apache.org
>> Sent: Fri, June 25, 2010 6:01:13 PM
>> Subject: Setting many properties for a multivalued field. Schema.xml ? 
>> External file?
>> 
>> Hi,
> 
> I'm trying to index data containing a multivalued field "picture", 
>> that has three properties: url, caption and description:
> 
> <picture/> 
>> 
>    <url/>
> 
>> <caption/>
>    <description/>
> 
> Thus, each 
>> indexed document might have many pictures, each of them has a url, a 
>> caption, 
>> and a description.
> 
> I wonder wether it's possible to store this data using 
>> only schema.xml. I couldn't figure it out so far. Instead, I'm thinking of 
>> using 
>> an external file to sore the properties of each picture, but I haven't tried 
>> yet 
>> this solution, waiting for your suggestions...
> 
> Thanks,
> -Saïd

Reply via email to