Hi, can you try like this:

/solr/live/stream?expr=leftOuterJoin(search(archive, q="posting_id:41009261", 
qt="/select", fl="posting_id", sort="posting_id asc"),search(live, 
q="posting_id:41009261", qt="/select", fl="posting_id", sort="posting_id 
asc"),on="posting_id")

Also don’t forget to urlencode special chars if your http client is not doing 
it automatically for you.

Sent from Mail for Windows 10

From: Anuj Bhargava
Sent: 02 May 2021 07:40
To: users@solr.apache.org
Subject: Re: Solr 8.6.2 - single query on 2 cores ?

Thanks. How can I use it in URL. Have tried the following -

*Try -1*
*http://aaa.bbb.ccc.ddd:8983/solr/live/select?leftOuterJoin(search(archive
<http://aaa.bbb.ccc.ddd:8983/solr/live/select?leftOuterJoin(search(archive>,
q="posting_id:44605514", qt="/select", fl="posting_id", sort="posting_id
asc"),search(live, q="posting_id:44605514", qt="/select", fl="posting_id",
sort="posting_id asc")on="posting_id")*

*Result -1*
*{*
*  "responseHeader":{*
*    "status":0,*
*    "QTime":0,*
*    "params":{*
*      "leftOuterJoin(search(archive, q":"\"posting_id:44605514\",
qt=\"/select\", fl=\"posting_id\", sort=\"posting_id asc\"),search(live,
q=\"posting_id:44605514\", qt=\"/select\", fl=\"posting_id\",
sort=\"posting_id asc\")on=\"posting_id\")"}},*
*  "response":{"numFound":0,"start":0,"numFoundExact":true,"docs":[]*
*  }}*

Try -2
http://aaa.bbb.ccc.ddd:8983/solr/live/select?leftOuterJoin(search(archive,
q="*:*", qt="/select", fl="posting_id", sort="posting_id asc"),search(live,
q="*:*", qt="/select", fl="posting_id", sort="posting_id
asc")on="posting_id=44605514")

Result -2
{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "leftOuterJoin(search(archive, q":"\"*:*\", qt=\"/select\",
fl=\"posting_id\", sort=\"posting_id asc\"),search(live, q=\"*:*\",
qt=\"/select\", fl=\"posting_id\", sort=\"posting_id
asc\")on=\"posting_id=44605514\")"}},
  "response":{"numFound":0,"start":0,"numFoundExact":true,"docs":[]
  }}

*Try -3*
*http://aaa.bbb.ccc.ddd:8983/solr/live/select?expr=leftOuterJoin(search(archive
<http://aaa.bbb.ccc.ddd:8983/solr/live/select?expr=leftOuterJoin(search(archive>,
q="posting_id:41009261", qt="/select", fl="posting_id", sort="posting_id
asc"),search(live, q="posting_id:41009261", qt="/select", fl="posting_id",
sort="posting_id asc"),on="posting_id")*

*Result-3*
*{*
*  "responseHeader":{*
*    "status":0,*
*    "QTime":0,*
*    "params":{*
*      "expr":"leftOuterJoin(search(archive, q=\"posting_id:41009261\",
qt=\"/select\", fl=\"posting_id\", sort=\"posting_id asc\"),search(live,
q=\"posting_id:41009261\", qt=\"/select\", fl=\"posting_id\",
sort=\"posting_id asc\"),on=\"posting_id\")"}},*
*  "response":{"numFound":0,"start":0,"numFoundExact":true,"docs":[]*
*  }}*


*Try -4*
*http://aaa.bbb.ccc.ddd:8983/solr/live/select?expr=leftOuterJoin(search(archive,q=posting_id:41009261,fl=posting_id),search(live,q=posting_id:41009261
<http://aaa.bbb.ccc.ddd:8983/solr/live/select?expr=leftOuterJoin(search(archive,q=posting_id:41009261,fl=posting_id),search(live,q=posting_id:41009261>,
fl=posting_id),on=posting_id)*

*Result-4*
*{*
*  "responseHeader":{*
*    "status":0,*
*    "QTime":0,*
*    "params":{*
*
"expr":"leftOuterJoin(search(archive,q=posting_id:41009261,fl=posting_id),search(live,q=posting_id:41009261,
fl=posting_id),on=posting_id)"}},*
*  "response":{"numFound":0,"start":0,"numFoundExact":true,"docs":[]*
*  }}*

*Try -5*
*http://aaa.bbb.ccc.ddd:8983/solr/live/stream?expr=leftOuterJoin(search(archive
<http://aaa.bbb.ccc.ddd:8983/solr/live/stream?expr=leftOuterJoin(search(archive>,
q="posting_id:41009261", qt="/select", fl="posting_id", sort="posting_id
asc"),search(live, q="posting_id:41009261", qt="/select", fl="posting_id",
sort="posting_id asc"),on="posting_id"*

*Result -5*
*{*
*  "result-set":{*
*    "docs":[{*
*        "EXCEPTION":"'leftOuterJoin(search(archive,
q=\"posting_id:41009261\", qt=\"/select\", fl=\"posting_id\",
sort=\"posting_id asc\"),search(live, q=\"posting_id:41009261\",
qt=\"/select\", fl=\"posting_id\", sort=\"posting_id
asc\"),on=\"posting_id\"' is not a proper expression clause",*
*        "EOF":true}]}}*


On Sat, 1 May 2021 at 04:14, ufuk yılmaz <uyil...@vivaldi.net.invalid>
wrote:

> Hi Anuj,
>
> First solution that comes to my mind is using streaming expressions.
>
> leftOuterJoin can do this:
>
>
> https://solr.apache.org/guide/8_6/stream-decorator-reference.html#leftouterjoin
>
> Example:
>
> leftOuterJoin(
>         search(archive, q=”postings_id:123”, qt=”/select”,
> fl=”postings_id”, sort=”postings_id asc”)
>         search(live, q=”postings_id:123”, qt=”/select”, fl=”postings_id”,
> sort=”postings_id asc”)
>         on=”postings_id”
> )
>
> If a document with postings_id:123 is found on live, it is used, otherwise
> document from archive collection is returned because documents from “right”
> (live) overwrites values onto “left” (archive). Add other required fields
> to fl parameter.
>
> Hope it helps
>
> Sent from Mail for Windows 10
>
> From: Anuj Bhargava
> Sent: 30 April 2021 16:25
> To: solr-u...@lucene.apache.org
> Subject: Solr 8.6.2 - single query on 2 cores ?
>
> I have 2 cores '*live*' and '*archive*' with exactly the same fields.
>
> I want to query on a unique id - '*posting_id*'. First it should check
> *live* and if not found then in *archive* and show the results.
>
> The following is doing a search on *live* and not on *archive*
>
> http://xxx:8983/solr/live/select?q=*:*&fq=posting_id:41009261&indent=true&shards=archive
>
> The following gives an error -
>
> http://xxx.yyy.zzz.aaa:8983/solr/live/select?q=*:*&fq=posting_id:41009261&indent=true&shards=xxx.yyy.zzz.aaa:8983/solr/archive
>
> <response>
> <lst name="responseHeader">
> <int name="status">401</int>
> <int name="QTime">10</int>
> <lst name="params">
> <str name="q">*:*</str>
> <str name="shards">xxx.yyy.zzz.aaa:8983/solr/archive</str>
> <str name="indent">true</str>
> <str name="fq">posting_id:41009261</str>
> <str name="wt">xml</str>
> </lst>
> </lst>
> <lst name="error">
> <lst name="metadata">
> <str
>
> name="error-class">org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException</str>
> <str
>
> name="root-error-class">org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException</str>
> </lst>
> <str name="msg">Error from server at null: Expected mime type
> application/octet-stream but got text/html. <html> <head> <meta
> http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error
> 401 Unauthorized</title> </head> <body><h2>HTTP ERROR 401 Unauthorized</h2>
> <table> <tr><th>URI:</th><td>/solr/archive/select</td></tr>
> <tr><th>STATUS:</th><td>401</td></tr>
> <tr><th>MESSAGE:</th><td>Unauthorized</td></tr>
> <tr><th>SERVLET:</th><td>default</td></tr> </table> </body> </html> </str>
> <int name="code">401</int>
> </lst>
> </response>
>
> How can I do a single query on 2 cores
>
> Have added the following in solr.in.sh - SOLR_OPTS="$SOLR_OPTS
> -Dsolr.disable.shardsWhitelist=true"
>
>

Reply via email to