Nested document workaround?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Nested document workaround?

Michael Jones
Hi,

I realise that you can't get nested document to search in solr.

But if I did this:

  <doc>
    <field name="source">Test</field>
    <field name="type">bar</field>
    <field name="label">Map</field>
    <field name="date_long"/>
    <field name="date_short"/>
    <field name="persons-0446_name">Graham</field>
    <field name="persons-0446_link">foo</field>
    <field name="persons-0446_location">Crosby</field>
    <field name="persons-0446_office"/>
    <field name="persons-0188_name">Bob</field>
    <field name="persons-0188_link">foo</field>
    <field name="persons-0188_location">test</field>
    <field name="persons-0188_office"/>
    <field name="persons-0183_name">Denzil</field>
    <field name="persons-0183_link">foo</field>
    <field name="persons-0183_location">test</field>
    <field name="persons-0183_office"/>
  </doc>

Could I still search for location with *_location ?

Or is there another way to get relational data into solr?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Nested document workaround?

Otis Gospodnetić
Would http://search-lucene.com/?q=solr+join do it for you?

Otis
--
SOLR Performance Monitoring - http://sematext.com/spm/index.html
Search Analytics - http://sematext.com/search-analytics/index.html




On Mon, Dec 10, 2012 at 1:17 PM, Michael Jones <[hidden email]>wrote:

> Hi,
>
> I realise that you can't get nested document to search in solr.
>
> But if I did this:
>
>   <doc>
>     <field name="source">Test</field>
>     <field name="type">bar</field>
>     <field name="label">Map</field>
>     <field name="date_long"/>
>     <field name="date_short"/>
>     <field name="persons-0446_name">Graham</field>
>     <field name="persons-0446_link">foo</field>
>     <field name="persons-0446_location">Crosby</field>
>     <field name="persons-0446_office"/>
>     <field name="persons-0188_name">Bob</field>
>     <field name="persons-0188_link">foo</field>
>     <field name="persons-0188_location">test</field>
>     <field name="persons-0188_office"/>
>     <field name="persons-0183_name">Denzil</field>
>     <field name="persons-0183_link">foo</field>
>     <field name="persons-0183_location">test</field>
>     <field name="persons-0183_office"/>
>   </doc>
>
> Could I still search for location with *_location ?
>
> Or is there another way to get relational data into solr?
>
> Thanks
>
Reply | Threaded
Open this post in threaded view
|

Re: Nested document workaround?

Alexandre Rafalovitch
In reply to this post by Michael Jones
How about aggregating all location fields into one searchable multi-Value
field using copyField? It could be an index-only collection. Then, you just
say all_locations:Crosby

Regards,
    Alex.

Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)



On Tue, Dec 11, 2012 at 5:17 AM, Michael Jones <[hidden email]>wrote:

> Hi,
>
> I realise that you can't get nested document to search in solr.
>
> But if I did this:
>
>   <doc>
>     <field name="source">Test</field>
>     <field name="type">bar</field>
>     <field name="label">Map</field>
>     <field name="date_long"/>
>     <field name="date_short"/>
>     <field name="persons-0446_name">Graham</field>
>     <field name="persons-0446_link">foo</field>
>     <field name="persons-0446_location">Crosby</field>
>     <field name="persons-0446_office"/>
>     <field name="persons-0188_name">Bob</field>
>     <field name="persons-0188_link">foo</field>
>     <field name="persons-0188_location">test</field>
>     <field name="persons-0188_office"/>
>     <field name="persons-0183_name">Denzil</field>
>     <field name="persons-0183_link">foo</field>
>     <field name="persons-0183_location">test</field>
>     <field name="persons-0183_office"/>
>   </doc>
>
> Could I still search for location with *_location ?
>
> Or is there another way to get relational data into solr?
>
> Thanks
>