Sounds like you are looking for parent/child docs here, see 
https://lucene.apache.org/solr/guide/8_5/indexing-nested-documents.html

{
        "type": "user",
        "name": "user1",
        "products": [
                { "id": "prod_A", "cost": 50},
                { "id": "prod_B", "cost": 200},
                { "id": "prod_D", "cost": 25}
        ]
}

This will index 4 documents - one user document and three product-cost child 
documents.

You can then search the child docs and return matching parents with e.g. 
q=*:*&fq={!parent which="type:user"}((id:prod_A AND cost:[50 TO 100]) OR 
(id:prod_D AND cost:[0 TO 40]))&fl=[child]

Hope this helps.

Jan

> 11. mai 2020 kl. 11:35 skrev Vignan Malyala <dsmsvig...@gmail.com>:
> 
> I have around 1M products used by my clients.
> Client need a filter of these 1M products by their cost filters.
> 
> Just like:
> User1 has 5 products (A,B,C,D,E)
> User2 has 3 products (D,E,F)
> User3 has 10 products (A,B,C,H,I,J,K,L,M,N,O)
> 
> ...every customer has different sets.
> 
> Now they want to search users by filter of product costs:
> Product_A_cost :  50 TO 100
> Product_D_cost :  0 TO 40
> 
> it should return all the users who use products in this filter range.
> 
> As I have 1M products, do I need to create dynamic fields for all users
> with filed names as Product_A_cost and product_B_cost..... etc to make a
> search by them? If I should, then I haveto create 1M dynamic fields
> Or is there any other way?
> 
> Hope I'm clear here!
> 
> 
> On Mon, May 11, 2020 at 1:47 PM Jan Høydahl <jan....@cominvent.com> wrote:
> 
>> Sounds like an anti pattern. Can you explain what search problem you are
>> trying to solve with this many unique fields?
>> 
>> Jan Høydahl
>> 
>>> 11. mai 2020 kl. 07:51 skrev Vignan Malyala <dsmsvig...@gmail.com>:
>>> 
>>> Hi
>>> Is it good idea to create 100000 dynamic fields of time pint in solr?
>>> I have that many fields to search on actually which come upon based on
>>> users.
>>> 
>>> Thanks in advance!
>>> And I'm using Solr Cloud in real-time.
>>> 
>>> Regards,
>>> Sai Vignan M
>> 

Reply via email to