lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Bernstein <joels...@gmail.com>
Subject Re: Consume sql response using solrj
Date Thu, 11 Aug 2016 17:04:00 GMT
There are no test cases for this but you can try this syntax:

select a from b where _query_=(a:c AND d:f)

This should get translated to:

_query_:(a:c AND d:f)

This link describes the behavior of _query_
https://lucidworks.com/blog/2009/03/31/nested-queries-in-solr/

Just not positive how the SQL parser will treat the : in the query.




Joel Bernstein
http://joelsolr.blogspot.com/

On Thu, Aug 11, 2016 at 12:22 PM, Pablo Anzorena <anzorena.fing@gmail.com>
wrote:

> Joel, one more thing.
>
> Is there anyway to use the sql and the lucene query syntax? The thing is
> that my bussiness application is tightly coupled with the lucene query
> syntax, so I need a way to use both the sql features (without the where
> clause) and the query syntax of lucene.
>
> Thanks.
>
> 2016-08-11 11:40 GMT-03:00 Pablo Anzorena <anzorena.fing@gmail.com>:
>
> > Excellent!
> >
> > Thanks Joel
> >
> > 2016-08-11 11:19 GMT-03:00 Joel Bernstein <joelsolr@gmail.com>:
> >
> >> There are two ways to do this with SolrJ:
> >>
> >> 1) Use the JDBC driver.
> >>
> >> 2) Use the SolrStream to send the request and then read() the Tuples.
> This
> >> is what the JDBC driver does under the covers. The sample code can be
> >> found
> >> here:
> >> https://github.com/apache/lucene-solr/blob/master/solr/solrj
> >> /src/java/org/apache/solr/client/solrj/io/sql/StatementImpl.java
> >>
> >> The constructStream() method creates a SolrStream with the request.
> >>
> >> Joel Bernstein
> >> http://joelsolr.blogspot.com/
> >>
> >> On Thu, Aug 11, 2016 at 10:05 AM, Pablo Anzorena <
> anzorena.fing@gmail.com
> >> >
> >> wrote:
> >>
> >> > Hey,
> >> >
> >> > I'm trying to get the response of solr via QueryResponse using
> >> > QueryResponse queryResponse = client.query(solrParams); (where client
> >> is a
> >> > CloudSolrClient)
> >> >
> >> > The error it thows is:
> >> >
> >> > org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:
> >> > Error
> >> > from server at http://tywin:8983/solr/testcollection1_shard1_replica1
> :
> >> > Expected mime type application/octet-stream but got text/plain.
> >> > {"result-set":{"docs":[
> >> > {"count(*)":5304,"d1":2},
> >> > {"count(*)":5160,"d1":1},
> >> > {"count(*)":5016,"d1":3},
> >> > {"count(*)":4893,"d1":4},
> >> > {"count(*)":4824,"d1":5},
> >> > {"EOF":true,"RESPONSE_TIME":11}]}}
> >> > at
> >> > org.apache.solr.client.solrj.impl.HttpSolrClient.
> >> > executeMethod(HttpSolrClient.java:558)
> >> >
> >> > Then I tryed to implement a custom ResponseParser that override the
> >> > getContentType() and returns "text/plain", but it returns another
> error.
> >> >
> >> > So... Is it a way to get the sql response via this method?
> >> >
> >> > I make it works via Connection and ResultSets, but I need to use the
> >> other
> >> > way (if possible).
> >> >
> >> > Thanks!
> >> >
> >>
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message