Representing a complex schema in solr

View: New views
2 Messages — Rating Filter:   Alert me  

Representing a complex schema in solr

by Rakhi Khatwani-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

i have a complex schema as shown below:

Book
    -  Title
    -  Category
    -  Publication
    -  Edition
    -  Publish Date
    -  Author (multivalued)   => Author is a multivalued field containing
the following attributes.
            -  Name
            -  Age
            -  Location
            -  Gender
            - Qualification


i wanna store the above information in solr so that i can query in every
aspect

one small query example would be:
1. search for all the books written by females.
2. search for all books writen by young authors...for example between the
age 22 to 30.

i woudn't wanna use RDBMS coz i have more than one million documents like
this.

i also tried saving the author as a JSON string. but then i cannot use wild
card and range queries on it.

any suggessions how wud i represent something like this in solr??

Regards,
Raakhi

Re: Representing a complex schema in solr

by Israel Ekpo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 7, 2009 at 11:37 PM, Rakhi Khatwani <rkhatwani@...> wrote:

> Hi,
>
> i have a complex schema as shown below:
>
> Book
>    -  Title
>    -  Category
>    -  Publication
>    -  Edition
>    -  Publish Date
>    -  Author (multivalued)   => Author is a multivalued field containing
> the following attributes.
>            -  Name
>            -  Age
>            -  Location
>            -  Gender
>            - Qualification
>
>
> i wanna store the above information in solr so that i can query in every
> aspect
>
> one small query example would be:
> 1. search for all the books written by females.
> 2. search for all books writen by young authors...for example between the
> age 22 to 30.
>
> i woudn't wanna use RDBMS coz i have more than one million documents like
> this.
>
> i also tried saving the author as a JSON string. but then i cannot use wild
> card and range queries on it.
>
> any suggessions how wud i represent something like this in solr??
>
> Regards,
> Raakhi
>


Hi Rakhi,

I think you should do this to simplify your storage and retrieval process:

Instead of having one multi-valued "author" field, store each attribute as a
separate multi-valued field.

So name, age, location, gender and qualification will be separate fields in
the schema.

This will allow you to query the way you are asking

q=gender:female

OR by age

q=age:[22 TO 30]

Use tint (solr.TrieIntField) for the age field (if you are using Solr 1.4)

--
"Good Enough" is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.