Hi,Solr team

About the join and crossCollection  query, I open the debugQuery, and the 
query, log and result is:


1. crossCollection Join
query:
http://localhost:8983/solr/advertising/select?indent=true&q.op=AND&q=%7B!join%20method%3D%27crossCollection%27%20fromIndex%3Dcompany%20from%3Did%20to%3Dadvertiser_id%20v%3D%27name%3A(nbc%20advertiser)%27%7D&debugQuery=true


Result:
Query numFound is 719
And in fromIndex(company), query is: name:(nbc advertiser), and numFound is 44.


Log:
INFO  - 2022-10-20 10:46:59.238; org.apache.solr.core.SolrCore.Request; 
[advertising_shard1_replica_n1]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=false&debug=timing&debug=track&fl=uid&fl=score&shards.purpose=16388&start=0&fsv=true&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard1_replica_n1/&rows=10&rid=-2833&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_TOP_IDS,SET_TERM_STATS&NOW=1666262819235&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=false}
 hits=197 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.239; org.apache.solr.core.SolrCore.Request; 
[advertising_shard2_replica_n2]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=false&debug=timing&debug=track&fl=uid&fl=score&shards.purpose=16388&start=0&fsv=true&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard2_replica_n2/&rows=10&rid=-2833&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_TOP_IDS,SET_TERM_STATS&NOW=1666262819235&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=false}
 hits=522 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.253; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=1
INFO  - 2022-10-20 10:46:59.260; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=1
INFO  - 2022-10-20 10:46:59.267; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=1
INFO  - 2022-10-20 10:46:59.275; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=1
INFO  - 2022-10-20 10:46:59.279; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.286; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.291; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=1
INFO  - 2022-10-20 10:46:59.296; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.301; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.306; org.apache.solr.core.SolrCore.Request; 
[company_shard1_replica_n1]  webapp=/solr path=/export 
params={q=name:(nbc+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=44 status=0 QTime=0
INFO  - 2022-10-20 10:46:59.311; org.apache.solr.core.SolrCore.Request; 
[advertising_shard1_replica_n1]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=timing&debug=track&shards.purpose=16704&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard1_replica_n1/&rows=10&rid=-2833&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_FIELDS,GET_DEBUG,SET_TERM_STATS&NOW=1666262819235&ids=CAM15469827,CAM15469826,CAM15469175,CAM500855,CAM500408,CAM15469797,CAM15469675,CAM15469768,CAM15469855,CAM15469613&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=true}
 status=0 QTime=67
INFO  - 2022-10-20 10:46:59.312; org.apache.solr.core.SolrCore.Request; 
[advertising_shard2_replica_n2]  webapp=/solr path=/select 
params={q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&indent=true&q.op=AND&debugQuery=true}
 rid=-2833 hits=719 status=0 QTime=77


But when I change the query:
http://localhost:8983/solr/advertising/select?indent=true&q.op=AND&q=%7B!join%20method%3D%27crossCollection%27%20fromIndex%3Dcompany%20from%3Did%20to%3Dadvertiser_id%20v%3D%27name%3A(nbc%20AND%20advertiser)%27%7D&debugQuery=true


Result:
Query numFound is 16
And in fromIndex(company), query is: name:(nbc AND advertiser), and numFound is 
2.


Log:
INFO - 2022-10-20 10:55:49.208; org.apache.solr.core.SolrCore.Request; 
[advertising_shard2_replica_n2] webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=false&debug=timing&debug=track&fl=uid&fl=score&shards.purpose=16388&start=0&fsv=true&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard2_replica_n2/&rows=10&rid=-2901&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+AND+advertiser)'}&omitHeader=false&requestPurpose=GET_TOP_IDS,SET_TERM_STATS&NOW=1666263349194&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=false}
 hits=13 status=0 QTime=1 INFO - 2022-10-20 10:55:49.208; 
org.apache.solr.core.SolrCore.Request; [advertising_shard1_replica_n1] 
webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=false&debug=timing&debug=track&fl=uid&fl=score&shards.purpose=16388&start=0&fsv=true&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard1_replica_n1/&rows=10&rid=-2901&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+AND+advertiser)'}&omitHeader=false&requestPurpose=GET_TOP_IDS,SET_TERM_STATS&NOW=1666263349194&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=false}
 hits=3 status=0 QTime=1 INFO - 2022-10-20 10:55:49.233; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=12 INFO - 2022-10-20 10:55:49.233; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=11 INFO - 2022-10-20 10:55:49.241; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.241; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.247; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.247; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.252; 
org.apache.solr.core.SolrCore.Request; [advertising_shard1_replica_n1] 
webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=timing&debug=track&shards.purpose=16704&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard1_replica_n1/&rows=10&rid=-2901&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+AND+advertiser)'}&omitHeader=false&requestPurpose=GET_FIELDS,GET_DEBUG,SET_TERM_STATS&NOW=1666263349194&ids=IO500409,CAM500408,PLC500410&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=true}
 status=0 QTime=37 INFO - 2022-10-20 10:55:49.253; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.258; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.262; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=0 INFO - 2022-10-20 10:55:49.270; 
org.apache.solr.core.SolrCore.Request; [company_shard1_replica_n1] webapp=/solr 
path=/export 
params={q=name:(nbc+AND+advertiser)&distrib=false&method=crossCollection&indent=off&fl=id&sort=id+asc&wt=javabin&version=2.2}
 hits=2 status=0 QTime=3 INFO - 2022-10-20 10:55:49.274; 
org.apache.solr.core.SolrCore.Request; [advertising_shard2_replica_n2] 
webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=timing&debug=track&shards.purpose=16704&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard2_replica_n2/&rows=10&rid=-2901&version=2&q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+AND+advertiser)'}&omitHeader=false&requestPurpose=GET_FIELDS,GET_DEBUG,SET_TERM_STATS&NOW=1666263349194&ids=IO501020,IO500477,IO501015,CAM501012,CAM500476,PLC500478,CAM501017&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=true}
 status=0 QTime=59 INFO - 2022-10-20 10:55:49.286; 
org.apache.solr.core.SolrCore.Request; [advertising_shard2_replica_n2] 
webapp=/solr path=/select 
params={q={!join+method%3D'crossCollection'+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+AND+advertiser)'}&indent=true&q.op=AND&debugQuery=true}
 rid=-2901 hits=16 status=0 QTime=91


2. Join query
query :
http://localhost:8983/solr/advertising/select?indent=true&q.op=AND&q=%7B!join%20fromIndex%3Dcompany%20from%3Did%20to%3Dadvertiser_id%20v%3D%27name%3A(nbc%20advertiser)%27%7D&debugQuery=true


Result:
Query numFound is 16


log:
INFO  - 2022-10-20 10:50:45.614; org.apache.solr.core.SolrCore.Request; 
[advertising_shard2_replica_n2]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=false&debug=timing&debug=track&fl=uid&fl=score&shards.purpose=16388&start=0&fsv=true&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard2_replica_n2/&rows=10&rid=-2858&version=2&q={!join+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_TOP_IDS,SET_TERM_STATS&NOW=1666263045601&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=false}
 hits=13 status=0 QTime=0
INFO  - 2022-10-20 10:50:45.614; org.apache.solr.core.SolrCore.Request; 
[advertising_shard1_replica_n1]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=false&debug=timing&debug=track&fl=uid&fl=score&shards.purpose=16388&start=0&fsv=true&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard1_replica_n1/&rows=10&rid=-2858&version=2&q={!join+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_TOP_IDS,SET_TERM_STATS&NOW=1666263045601&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=false}
 hits=3 status=0 QTime=1
INFO  - 2022-10-20 10:50:45.632; org.apache.solr.core.SolrCore.Request; 
[advertising_shard1_replica_n1]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=timing&debug=track&shards.purpose=16704&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard1_replica_n1/&rows=10&rid=-2858&version=2&q={!join+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_FIELDS,GET_DEBUG,SET_TERM_STATS&NOW=1666263045601&ids=IO500409,CAM500408,PLC500410&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=true}
 status=0 QTime=12
INFO  - 2022-10-20 10:50:45.633; org.apache.solr.core.SolrCore.Request; 
[advertising_shard2_replica_n2]  webapp=/solr path=/select 
params={df=name&distrib=false&preferLocalShards=false&debug=timing&debug=track&shards.purpose=16704&q.op=AND&shard.url=http://172.20.0.10:8983/solr/advertising_shard2_replica_n2/&rows=10&rid=-2858&version=2&q={!join+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&omitHeader=false&requestPurpose=GET_FIELDS,GET_DEBUG,SET_TERM_STATS&NOW=1666263045601&ids=IO501020,IO500477,IO501015,CAM501012,CAM500476,PLC500478,CAM501017&isShard=true&timeAllowed=15000&wt=javabin&debugQuery=true}
 status=0 QTime=13
INFO  - 2022-10-20 10:50:45.634; org.apache.solr.core.SolrCore.Request; 
[advertising_shard1_replica_n1]  webapp=/solr path=/select 
params={q={!join+fromIndex%3Dcompany+from%3Did+to%3Dadvertiser_id+v%3D'name:(nbc+advertiser)'}&indent=true&q.op=AND&debugQuery=true}
 rid=-2858 hits=16 status=0 QTime=33


3. Collection company query:
q,op=OR query: 
http://localhost:8983/solr/company/select?indent=true&q.op=OR&q=name%3A(nbc%20advertiser)
numFound: 44
q,op=AND query: 
http://localhost:8983/solr/company/select?indent=true&q.op=AND&q=name%3A(nbc%20advertiser)
numFound: 2 
4. The Conslusion
In join query, the q.op=AND in query parameters can apply to the fromIndex 
query.
But in crossCollection join, the q.op=AND in query parameters can not apply to 
the fromIndex query, fromIndex query use q.op=OR
So, using crossCollection  join, If I don not change the fromIndex query from 
name:(nbc, advertiser) to name:(nbc AND advertiser).
How I shoud configure the solr configure file, the q.op=AND will apply to the 
fromIndex query? Or is this a bug for crossCollection  join?
Hope to get you response, thanks!





At 2022-10-19 19:59:31, "邵长城" <changchengsh2...@126.com> wrote:

Hi, Solr team


I am using Solr 8.11 to change join query to crossCollection join.
When I compare the query and result, I noticed something different.


If the join query is: q.op=AND&q=network_id:144750 AND {!join fromIndex=company 
from=id to=advertiser_id v='name:(sky vip) AND index_type:ADV'}
When query the fromIndex(company), the q.op=AND will work on name:(sky vip), so 
the value of name must contains sky and vip.


If the crossCollection  join query is: q.op=AND&q=network_id:144750 AND {!join 
method='crossCollection' fromIndex=company from=id to=advertiser_id 
v='name:(sky vip) AND index_type:ADV'}
When query the fromIndex(company), the q.op=AND not work on name:(sky vip). In 
other workds,  the value of name shoud contains sky or vip, It used q.op=OR.


So I want to ask, how I shoud configure the solr configure file or how do I 
write the query, the q.op=AND will apply to the fromIndex query.


Hope to get you response, thanks!

Reply via email to