Does SolrJ support JSON DSL?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Does SolrJ support JSON DSL?

Alexandre Rafalovitch
Hi,

Does anybody know if it is possible to do the new JSON DSL and JSON
Facets requests via SolrJ. The SolrJ documentation is a bit sparse and
I don't often use it. So, I can't figure out if there is a direct
support or even a pass-through workaround.

Thank you,
   Alex.
Reply | Threaded
Open this post in threaded view
|

Re: Does SolrJ support JSON DSL?

Mikhail Khludnev-2
There's nothing out-of-the-box.

On Fri, Oct 5, 2018 at 5:34 PM Alexandre Rafalovitch <[hidden email]>
wrote:

> Hi,
>
> Does anybody know if it is possible to do the new JSON DSL and JSON
> Facets requests via SolrJ. The SolrJ documentation is a bit sparse and
> I don't often use it. So, I can't figure out if there is a direct
> support or even a pass-through workaround.
>
> Thank you,
>    Alex.
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: Does SolrJ support JSON DSL?

Chris Hostetter-3

: There's nothing out-of-the-box.

Which is to say: there are no explicit convenience methods for it, but you
can absolutely use the JSON DSL and JSON facets via SolrJ and the
QueryRequest -- just add the param key=value that you want, where the
value is the JSON syntax...

ModifiableSolrParams p = new ModifiableSolrParams()
p.add("json.facet","{ ... }");
// and/or: p.add("json", "{ ... }");
QueryRequest req = new QueryRequest(p, SolrRequest.METHOD.POST);
QueryResponse rsp = req.process(client);

: On Fri, Oct 5, 2018 at 5:34 PM Alexandre Rafalovitch <[hidden email]>
: wrote:
:
: > Hi,
: >
: > Does anybody know if it is possible to do the new JSON DSL and JSON
: > Facets requests via SolrJ. The SolrJ documentation is a bit sparse and
: > I don't often use it. So, I can't figure out if there is a direct
: > support or even a pass-through workaround.
: >
: > Thank you,
: >    Alex.
: >
:
:
: --
: Sincerely yours
: Mikhail Khludnev
:

-Hoss
http://www.lucidworks.com/
Reply | Threaded
Open this post in threaded view
|

Re: Does SolrJ support JSON DSL?

Christian Ortner
On Sat, Oct 6, 2018 at 1:04 AM Chris Hostetter <[hidden email]>
wrote:

> Which is to say: there are no explicit convenience methods for it, but you
> can absolutely use the JSON DSL and JSON facets via SolrJ and the
> QueryRequest -- just add the param key=value that you want, where the
> value is the JSON syntax...
>

For more convenience with relatively complex JSON facet queries, I like
having some data classes and enums that make building a valid JSON facet
data structure faster and safer. In the end, just before sending the query,
I just use Jackson to turn the object graph into JSON.