Discussion:
Select distinct multiple fields
thiaga rajan
2016-05-19 16:41:34 UTC
Permalink
Hi Team - I have seen select distinct multiple fields is not possible in Solr and i have seen suggestions coming up on faceting and grouping. I have some questions. Is there any with any kind of plugins/custom implementation we can achieve the same
1. Using any plugin or through custom implementation whether we will be able to achieve the select distinct fields apart from facet and group by...Because the pagination is kind of issue.
For example - We are setting a pagination of 10. If we are getting 10 records (along with the duplicates) then we might ending up a getting the results less than 10. 
Any suggestions on this?
Joel Bernstein
2016-05-19 17:11:23 UTC
Permalink
https://cwiki.apache.org/confluence/display/solr/Parallel+SQL+Interface?focusedCommentId=62697742#ParallelSQLInterface-SELECTDISTINCTQueries

Joel Bernstein
http://joelsolr.blogspot.com/
The SQL interface and Streaming Expressions support selecting multiple
distinct fields.
The SQL interface can use the JSON facet API or MapReduce to provide the
results.
You the facet function and unique function are the Streaming Expressions
that the SQL interface calls.
Joel Bernstein
http://joelsolr.blogspot.com/
On Thu, May 19, 2016 at 12:41 PM, thiaga rajan <
Post by thiaga rajan
Hi Team - I have seen select distinct multiple fields is not possible in
Solr and i have seen suggestions coming up on faceting and grouping. I have
some questions. Is there any with any kind of plugins/custom implementation
we can achieve the same
1. Using any plugin or through custom implementation whether we will be
able to achieve the select distinct fields apart from facet and group
by...Because the pagination is kind of issue.
For example - We are setting a pagination of 10. If we are getting 10
records (along with the duplicates) then we might ending up a getting the
results less than 10.
Any suggestions on this?
thiaga rajan
2016-05-19 20:23:20 UTC
Permalink
Thanks Joel for the response. In our requirement there is some logic that needs to be implemented after fetching the results from solr which might have an impact in working out the pagination

ie, we have data structures like(nested structure is flattened) we need to have this kind of structure as below we might need to support some other use cases. Hierarchical structure will not support other use cases. So we have flatten our data structure and we need to achieve the search in the flat structure below

| Level1 | Level2 | Level3 |
| 1 | 11 | 111 |
| 1 | 11 | 112 |
| 1 | 11 | 113 |
| 1 | 11 | 114 |

 Example - When the customer enters 11 we might need to query this word from the entire data structure. 
so we will get all the records including Level3 as well. But ideally we need to select only 1,11(filtering the current level and parent level). Also another problem is pagination. We might select 10 recs from example after filtering the levels/parent matching with the search keyword, the number of records might get reduced. So we might need to send another request to solr to get the next set and again working out the level and its parent which matches with the search keyword till we reach the required row count. 

Rather than doing this, is there a way(kind of any plugin like SearchComponent) will help with the above scenaio or best way to achieve this in solr?Kindly provide your valuable suggestions on this



On Thursday, 19 May 2016 6:11 PM, Joel Bernstein <***@gmail.com> wrote:


https://cwiki.apache.org/confluence/display/solr/Parallel+SQL+Interface?focusedCommentId=62697742#ParallelSQLInterface-SELECTDISTINCTQueries

Joel Bernsteinhttp://joelsolr.blogspot.com/

On Thu, May 19, 2016 at 1:10 PM, Joel Bernstein <***@gmail.com> wrote:

The SQL interface and Streaming Expressions support selecting multiple distinct fields.
The SQL interface can use the JSON facet API or MapReduce to provide the results.
You the facet function and unique function are the Streaming Expressions that the SQL interface calls.
Joel Bernsteinhttp://joelsolr.blogspot.com/

On Thu, May 19, 2016 at 12:41 PM, thiaga rajan <***@yahoo.co.in.invalid> wrote:

Hi Team - I have seen select distinct multiple fields is not possible in Solr and i have seen suggestions coming up on faceting and grouping. I have some questions. Is there any with any kind of plugins/custom implementation we can achieve the same
1. Using any plugin or through custom implementation whether we will be able to achieve the select distinct fields apart from facet and group by...Because the pagination is kind of issue.
For example - We are setting a pagination of 10. If we are getting 10 records (along with the duplicates) then we might ending up a getting the results less than 10. 
Any suggestions on this?

Continue reading on narkive:
Loading...