Hi Ares,

How about using field collapsing?  https://wiki.apache.org/solr/FieldCollapsing

&q=+region:(east OR west) +productName:iPhone
&group=true
&group.field=dealer


If the number of distinct groups is high, CollapsingQueryParser could be used 
too.

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-CollapsingQueryParser

Ahmet


On Tuesday, March 25, 2014 10:50 AM, cmd.ares <cmd.a...@gmail.com> wrote:
my_index(one core):
id,dealer,productName,amount,region 
1,A1,iphone4,400,east
2,A1,iphone4s,450,east
3,A2,iphone5s,550,east
......
4,A1,iphone4,400,west
5,A1,iphone4s,450,west
6,A3,iphone5s,550,west
......


-----I'd like to get which dealer sale the 'iphone' both in the 'east' and
'west' 
pl/sql reference implementation:
1:
select dealer from my_index where region='east' and productName like
'%iphone%'
intersect
select dealer from my_index where region='west' and productName like
'%iphone%'
2:
select distinct dealer from my_index where region='east' and productName
like '%iphone%' and sales in (
select dealer from my_index where region='west' and productName like
'%iphone%'
)

solr reference implementation:
1.query parameters:
q=region:east AND productName:iphone
&fq={!join from=dealer to=dealer}(region:west AND productName:iphone)
&facet=true&facet.filed=dealer&facet.mincount=1

2.query parameters:
q=region:east AND productName:iphone({!join from=dealer
to=dealer}region:west AND productName:iphone)
&facet=true&facet.filed=dealer&facet.mincount=1

with the big index,the query is very slow.Is there any efficient way to
improve performance?

1.if must use solr join feature??if there are other approach??
2.if multicore shards can improve performance?? 
/***
as the wiki said:
In a DistributedSearch environment, you can not Join across cores on
multiple nodes. 
If however you have a custom sharding approach, you could join across cores
on the same node.
***/



--
View this message in context: 
http://lucene.472066.n3.nabble.com/intersect-query-tp4126828.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to