Sorting in other collection in Solr 8.5.1

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

Sorting in other collection in Solr 8.5.1

vishal patel-2
Hi

I am upgrading Solr 8.5.1. I have created 2 shards and each has one replica.
I have created 2 collection one is form and second is actionscomment.forms related data are stored in form collection and actions of that forms are stored in actionscomment collection.
There are 10 lakh documents in form and 50 lakh documents in actionscomment collection.

form schema.xml
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" docValues="true"/>
<field name="project_id" type="tint" indexed="true" stored="true" docValues="true"/>
<field name="form_id" type="tint" indexed="true" stored="true" docValues="true"/>
<field name="title" type="text_string" indexed="true" stored="true" omitNorms="true"/>
<field name="form_creation_date" type="date" indexed="true" stored="true" docValues="true"/>

actionscomment schema.xml
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" docValues="true"/>
<field name="project_id" type="tint" indexed="true" stored="true" docValues="true"/>
<field name="form_id" type="tint" indexed="true" stored="true" docValues="true"/>
<field name="action_id" type="tint" indexed="true" stored="true"/>
<field name="title" type="text_string" indexed="true" stored="true" omitNorms="true"/>
<field name="action_date" type="date" indexed="true" stored="true" docValues="true"/>
<field name="action_complete_date" type="date" indexed="true" stored="true" docValues="true"/>



We are showing form listing using form and actionscomment collection. We are showing only 250 records in form listing page. Our form listing columns are id,title,form created date and action names. id,title,form created date and action names come from form collection and action names come from actionscomment collection. We want to give the sorting functionality for all columns.It is easy to sort id, title and form created date because it is in same collection.

For action name sorting, I execute 2 query. First I execute query in actionscomment collection with sort field title and get the form_id list and using those form_ids I execute in form collection. But I do not get the proper sorting. Sometimes I got so many form ids and my second query length becomes larger.
How can I get data from form collection same as order of form id list came from actionscomment?

Regards,
Vishal Patel
Reply | Threaded
Open this post in threaded view
|

Re: Sorting in other collection in Solr 8.5.1

Zheng Lin Edwin Yeo
Hi Vishal,

Maybe you can post your query that you are using which has the issue too.

Regards,
Edwin

On Sat, 23 May 2020 at 22:27, vishal patel <[hidden email]>
wrote:

> Hi
>
> I am upgrading Solr 8.5.1. I have created 2 shards and each has one
> replica.
> I have created 2 collection one is form and second is actionscomment.forms
> related data are stored in form collection and actions of that forms are
> stored in actionscomment collection.
> There are 10 lakh documents in form and 50 lakh documents in
> actionscomment collection.
>
> form schema.xml
> <field name="id" type="string" indexed="true" stored="true"
> required="true" multiValued="false" docValues="true"/>
> <field name="project_id" type="tint" indexed="true" stored="true"
> docValues="true"/>
> <field name="form_id" type="tint" indexed="true" stored="true"
> docValues="true"/>
> <field name="title" type="text_string" indexed="true" stored="true"
> omitNorms="true"/>
> <field name="form_creation_date" type="date" indexed="true" stored="true"
> docValues="true"/>
>
> actionscomment schema.xml
> <field name="id" type="string" indexed="true" stored="true"
> required="true" multiValued="false" docValues="true"/>
> <field name="project_id" type="tint" indexed="true" stored="true"
> docValues="true"/>
> <field name="form_id" type="tint" indexed="true" stored="true"
> docValues="true"/>
> <field name="action_id" type="tint" indexed="true" stored="true"/>
> <field name="title" type="text_string" indexed="true" stored="true"
> omitNorms="true"/>
> <field name="action_date" type="date" indexed="true" stored="true"
> docValues="true"/>
> <field name="action_complete_date" type="date" indexed="true"
> stored="true" docValues="true"/>
>
>
>
> We are showing form listing using form and actionscomment collection. We
> are showing only 250 records in form listing page. Our form listing columns
> are id,title,form created date and action names. id,title,form created date
> and action names come from form collection and action names come from
> actionscomment collection. We want to give the sorting functionality for
> all columns.It is easy to sort id, title and form created date because it
> is in same collection.
>
> For action name sorting, I execute 2 query. First I execute query in
> actionscomment collection with sort field title and get the form_id list
> and using those form_ids I execute in form collection. But I do not get the
> proper sorting. Sometimes I got so many form ids and my second query length
> becomes larger.
> How can I get data from form collection same as order of form id list came
> from actionscomment?
>
> Regards,
> Vishal Patel
>