lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Rafalovitch <arafa...@gmail.com>
Subject Re: Map Complex Datastructure with Solr
Date Thu, 02 Aug 2012 17:53:04 GMT
You are not going to get nested entries. So, your sample result is not
possible. Perhaps you just need to flatten your searchable fields into
individual article entries and then use a separate DB query to get the
product information back out of the database.

SOLR is not a database, even a NoSQL one. They added more features in
that direction for 4.0, but the use cases are limited.

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 Wed, Aug 1, 2012 at 2:14 PM, Thomas Gravel <thomas.gravel@gmail.com> wrote:
> hm ok I think i have to write my example data and the queries I want
> to make + the response I expect...
>
> Data:
>
> {
>         "product_id": "xyz76",
>         "product_name": "tank top",
>         "brand": "adidas",
>         "description":"this is the long description of the product",
>         "short_description":"this is the short description of the product",
>         "product_image":"/images/tanktop.jpg",
>         "product_image":"/images/tanktop2.jpg",
>         "article_list": [
>                 {
>                         "article_number": "TR47",
>                         "color": "red",
>                         "price": 10.99,
>                         "size": "XL",
>                         "unit": "1 piece",
>                         "inStore": true
>                 },
>                 {
>                         "article_number": "TR48",
>                         "color": "blue",
>                         "price": 15.99,
>                         "size": "XL",
>                         "unit": "1 piece",
>                         "inStore": false
>                 }
>         ]
> }
>
> I want to search:
> - article_number (i.e with inStore = true)
> - color
> - description
> - short_description
> - product_name
>
> Facets:
> - brand
> - color
> - size
> - price
>
> example query-response
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":2,
>     "params":{
>       "indent":"on",
>       "start":"0",
>       "q":"IBProductName:Durch*",
>       "wt":"json",
>       "version":"2.2",
>       "rows":"10"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "product_id": "xyz76",
>         "product_name": "tank top",
>         "brand": "adidas",
>         "description":"this is the long description of the product",
>         "short_description":"this is the short description of the product",
>         "product_image":"/images/tanktop.jpg",
>         "product_image":"/images/tanktop2.jpg",
>         "article_list": [
>                 {
>                         "color": "red",
>                         "price": 10.99,
>                         "size": "XL",
>                         "unit": "1 piece",
>                         "inStore": true
>                 },
>                 {
>                         "color": "blue",
>                         "price": 15.99,
>                         "size": "XL",
>                         "unit": "1 piece",
>                         "inStore": false
>                 }
>         ]
>
>                 }
>         ]
>   }}
>
>
> 2012/8/1 Alexandre Rafalovitch <arafalov@gmail.com>:
>> Sorry, that did not explain the problem, just more info about data
>> layout. What are you actually trying to get out of SOLR?
>>
>> Are you saying you want parent's details repeated in every entry? Are
>> you saying that you want to be able to find entries and from there,
>> being able to find specific parent.
>>
>> Whatever you do, SOLR will return you a list of flat entries plus some
>> statistics on occurrences and facets. Given that, what would you like
>> to see?
>>
>> 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 Wed, Aug 1, 2012 at 12:33 PM, Thomas Gravel <thomas.gravel@gmail.com> wrote:
>>> Thanks for the answer.
>>>
>>> Ich have to explain, where the problem is...
>>>
>>> you may have at the shop solutions products and articles.
>>> The product is the parent of all articles...
>>>
>>> in json...
>>>
>>> {
>>>    "product_name": "tank top",
>>>    "article_list": [
>>>          {
>>>               "color": "red",
>>>               "price": 10.99,
>>>               "size": "XL",
>>>               "inStore": true
>>>          },
>>>          {
>>>               "color": "blue",
>>>               "price": 15.99,
>>>               "size": "XL",
>>>               "inStore": false
>>>          }
>>>    ]
>>> }
>>>
>>> the problem is not the search (i think, because you can use
>>> copyField), but the searchresults...
>>>
>>> I have read the possibility to create own FieldTypes, but I don't know
>>> if this is the answer of my issues...
>>>
>>> 2012/8/1 Jack Krupansky <jack@basetechnology.com>:
>>>> The general rule is to flatten the structures. You have a choice between
>>>> sharing common fields between tables, such as "title", or adding a
>>>> prefix/suffix to qualify them, such as "document_title" vs. "product_title".
>>>>
>>>> You also have the choice of storing different tables in separate Solr
>>>> cores/collections, but then you have the burden of querying them separately
>>>> and coordinating the separate results on your own. It all depends on your
>>>> application.
>>>>
>>>> A lot hinges on:
>>>>
>>>> 1. How do you want to search the data?
>>>> 2. How do you want to access the fields once the Solr documents have been
>>>> identified by a query - such as fields to retrieve, "join", etc.
>>>>
>>>> So, once the data is indexed, what are your requirements for accessing the
>>>> data? E.g., some sample pseudo-queries and the fields you want to access.
>>>>
>>>> -- Jack Krupansky
>>>>
>>>> -----Original Message----- From: Thomas Gravel
>>>> Sent: Wednesday, August 01, 2012 9:52 AM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Map Complex Datastructure with Solr
>>>>
>>>>
>>>> Hi,
>>>> how can I map these complex Datastructure in Solr?
>>>>
>>>> Document
>>>>    - Groups
>>>>         - Group_ID
>>>>         - Group_Name
>>>>         - .....
>>>>   - Title
>>>>   - Chapter
>>>>         - Chapter_Title
>>>>         - Chapter_Content
>>>>
>>>>
>>>> Or
>>>>
>>>> Product
>>>>    - Groups
>>>>         - Group_ID
>>>>         - Group_Name
>>>>         - .....
>>>>   - Title
>>>>   - Articles
>>>>         - Artilce_ID
>>>>         - Artilce_Color
>>>>         - Artilce_Size
>>>>
>>>> Thanks for ideas....

Mime
View raw message