You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Gupta, Veeranjaneya" <Ve...@travelocity.com> on 2012/02/01 06:58:44 UTC

Hierarchical faceting with solr 1.4 version

Hi,

I am using SOLR1.4 version. I have a requirement to display the data as below.

<Polygon id="TX172-0000" type="MSA" name="Dallas/Ft. Worth" dictionaryId="297224">
<Polygon id="TX172-0200" type="Area" name="Denton" dictionaryId="296635"/>
<Polygon id="TX172-1000" type="Area" name="Grand Prairie" dictionaryId="400702">
<Polygon id="TX172-0601" type="Hood" name="Entertainment District" dictionaryId="14993"/>
<Polygon id="TX172-0404" type="Hood" name="South Dallas" dictionaryId="279265"/>
</Polygon>
<Polygon id="TX172-0800" type="Area" name="Northeast Dallas" dictionaryId="297286">
<Polygon id="TX172-0809" type="Hood" name="Park Central" dictionaryId="15424"/>
<Polygon id="TX172-0808" type="Hood" name="Addison" dictionaryId="15384"/>
<Polygon id="TX172-0807" type="Hood" name="Galleria" dictionaryId="15417"/>
</Polygon>
<Polygon id="TX172-0300" type="Area" name="Fort Worth" dictionaryId="296683">
<Polygon id="TX172-0305" type="Hood" name="TCU and Forest Park" dictionaryId="279770"/>
<Polygon id="TX172-0303" type="Hood" name="North Fort Worth and Fossil Creek" dictionaryId="278905"/>
<Polygon id="TX172-0302" type="Hood" name="Alliance and Texas Motor Speedway" dictionaryId="296856"/>
</Polygon>
</Polygon>

Here we store 3 types of polygons MSA, AREA and HOOD.
One MSA can have more than one AREA types as children and one AREA can have more than one HOOD types as children.
How to store this kind of data in solr and how to query the solr to get this hierarchical data?

Thanks, Gupta

Re: Hierarchical faceting with solr 1.4 version

Posted by Erick Erickson <er...@gmail.com>.
Well, a lot depends on how you need to query. The simplest
would be to store triplets MSA/Area/Hood, that is denormalize
the data and store each. If you used a multiValued field to store
it, you could do some tricky dancing with positionIncrementGap
to insure that matches occurred as you wish.

But if that doesn't make sense, perhaps you could expand on
the kinds of queries that need to happen.

Best
Erick

On Wed, Feb 1, 2012 at 12:58 AM, Gupta, Veeranjaneya
<Ve...@travelocity.com> wrote:
> Hi,
>
> I am using SOLR1.4 version. I have a requirement to display the data as below.
>
> <Polygon id="TX172-0000" type="MSA" name="Dallas/Ft. Worth" dictionaryId="297224">
> <Polygon id="TX172-0200" type="Area" name="Denton" dictionaryId="296635"/>
> <Polygon id="TX172-1000" type="Area" name="Grand Prairie" dictionaryId="400702">
> <Polygon id="TX172-0601" type="Hood" name="Entertainment District" dictionaryId="14993"/>
> <Polygon id="TX172-0404" type="Hood" name="South Dallas" dictionaryId="279265"/>
> </Polygon>
> <Polygon id="TX172-0800" type="Area" name="Northeast Dallas" dictionaryId="297286">
> <Polygon id="TX172-0809" type="Hood" name="Park Central" dictionaryId="15424"/>
> <Polygon id="TX172-0808" type="Hood" name="Addison" dictionaryId="15384"/>
> <Polygon id="TX172-0807" type="Hood" name="Galleria" dictionaryId="15417"/>
> </Polygon>
> <Polygon id="TX172-0300" type="Area" name="Fort Worth" dictionaryId="296683">
> <Polygon id="TX172-0305" type="Hood" name="TCU and Forest Park" dictionaryId="279770"/>
> <Polygon id="TX172-0303" type="Hood" name="North Fort Worth and Fossil Creek" dictionaryId="278905"/>
> <Polygon id="TX172-0302" type="Hood" name="Alliance and Texas Motor Speedway" dictionaryId="296856"/>
> </Polygon>
> </Polygon>
>
> Here we store 3 types of polygons MSA, AREA and HOOD.
> One MSA can have more than one AREA types as children and one AREA can have more than one HOOD types as children.
> How to store this kind of data in solr and how to query the solr to get this hierarchical data?
>
> Thanks, Gupta