You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jochen Barth <ba...@ub.uni-heidelberg.de> on 2019/08/26 13:25:29 UTC

facetting+tagging in JSON Query DSL

Dear reader,

I'm trying to do this: 
https://lucene.apache.org/solr/guide/8_1/faceting.html#tagging-and-excluding-filters 


with JSON Query DSL: 
https://lucene.apache.org/solr/guide/8_1/json-query-dsl.html#tagging-in-json-query-dsl

here is the complete query - essential parts in red (see below):

But it does not seem to work - has this perhaps to do with 
bool:{should:[...]} in {filter:...}?

Kind regards, Jochen

start=0&rows=50&sort=sort_title_s%20asc&fl=id&facet=true&facet.mincount=1&facet.field=%7B%21ex%3Dtype_s%7Dtype_s&facet.field=meta_name_ss&facet.field=meta_periodical_title_s&facet.field=meta_subject_ss&facet.range=meta_date_dtrs&f.meta_date_dtrs.facet.range.start=0000-01-01T00%3A00%3A00Z&f.meta_date_dtrs.facet.range.end=2100-01-01T00%3A00%3A00Z&f.meta_date_dtrs.facet.range.gap=%2B1YEAR&json={"filter":[{"bool":{"should":[{"#type_s":"type_s:article"}]}}],"query":{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"graph":{"from":"parent_ids","query":"meta_title_txt:sonne 
meta_name_txt:sonne meta_subject_txt:sonne 
meta_shelflocator_txt:sonne","to":"id"}},{"graph":{"from":"id","query":"text_ocr_ft:sonne 
text_heidicon_ft:sonne text_watermark_ft:sonne text_catalogue_ft:sonne 
text_index_ft:sonne text_tei_ft:sonne text_abstract_ft:sonne 
text_pdf_ft:sonne","to":"parent_ids","traversalFilter":"class_s:meta 
-type_s:multivolume_work -type_s:periodical -type_s:issue 
-type_s:journal"}}]}}]}},"class_s:meta"],"must_not":[{"join":{"from":"parent_ids","query":{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"graph":{"from":"parent_ids","query":"meta_title_txt:sonne 
meta_name_txt:sonne meta_subject_txt:sonne 
meta_shelflocator_txt:sonne","to":"id"}},{"graph":{"from":"id","query":"text_ocr_ft:sonne 
text_heidicon_ft:sonne text_watermark_ft:sonne text_catalogue_ft:sonne 
text_index_ft:sonne text_tei_ft:sonne text_abstract_ft:sonne 
text_pdf_ft:sonne","to":"parent_ids","traversalFilter":"class_s:meta 
-type_s:multivolume_work -type_s:periodical -type_s:issue 
-type_s:journal"}}]}}]}},"class_s:meta"]}},"to":"id"}}]}}}

-- 
Jochen Barth * Universitätsbibliothek Heidelberg, IT * Telefon 06221 54-2580


Re: facetting+tagging in JSON Query DSL

Posted by Mikhail Khludnev <mk...@apache.org>.
I suppose tagging won't work on below the top level like
"filter":[{"bool":{"should":[{"#type_s":"type_s:article"}]}}]
It should be something like     "filter":["#type_s":{"bool":{"
should":["type_s:article"]}}]

On Mon, Aug 26, 2019 at 4:29 PM Jochen Barth <ba...@ub.uni-heidelberg.de>
wrote:

> Oops.. my thunderbird did not preserve color...
> the keywords to look for in the query are
>
> »facet.field=%7B%21ex%3Dtype_s%7Dtype_s«
> and
> »{"#type_s":"type_s:article"}«
>
> Kind regards, Jochen
>
> Am 26.08.19 um 15:25 schrieb Jochen Barth:
> > Dear reader,
> >
> > I'm trying to do this:
> >
> https://lucene.apache.org/solr/guide/8_1/faceting.html#tagging-and-excluding-filters
> >
> >
> > with JSON Query DSL:
> >
> https://lucene.apache.org/solr/guide/8_1/json-query-dsl.html#tagging-in-json-query-dsl
> >
> > here is the complete query - essential parts in red (see below):
> >
> > But it does not seem to work - has this perhaps to do with
> > bool:{should:[...]} in {filter:...}?
> >
> > Kind regards, Jochen
> >
> >
> start=0&rows=50&sort=sort_title_s%20asc&fl=id&facet=true&facet.mincount=1&facet.field=%7B%21ex%3Dtype_s%7Dtype_s&facet.field=meta_name_ss&facet.field=meta_periodical_title_s&facet.field=meta_subject_ss&facet.range=meta_date_dtrs&f.meta_date_dtrs.facet.range.start=0000-01-01T00%3A00%3A00Z&f.meta_date_dtrs.facet.range.end=2100-01-01T00%3A00%3A00Z&f.meta_date_dtrs.facet.range.gap=%2B1YEAR&json={"filter":[{"bool":{"should":[{"#type_s":"type_s:article"}]}}],"query":{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"graph":{"from":"parent_ids","query":"meta_title_txt:sonne
>
> > meta_name_txt:sonne meta_subject_txt:sonne
> >
> meta_shelflocator_txt:sonne","to":"id"}},{"graph":{"from":"id","query":"text_ocr_ft:sonne
>
> > text_heidicon_ft:sonne text_watermark_ft:sonne text_catalogue_ft:sonne
> > text_index_ft:sonne text_tei_ft:sonne text_abstract_ft:sonne
> > text_pdf_ft:sonne","to":"parent_ids","traversalFilter":"class_s:meta
> > -type_s:multivolume_work -type_s:periodical -type_s:issue
> >
> -type_s:journal"}}]}}]}},"class_s:meta"],"must_not":[{"join":{"from":"parent_ids","query":{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"graph":{"from":"parent_ids","query":"meta_title_txt:sonne
>
> > meta_name_txt:sonne meta_subject_txt:sonne
> >
> meta_shelflocator_txt:sonne","to":"id"}},{"graph":{"from":"id","query":"text_ocr_ft:sonne
>
> > text_heidicon_ft:sonne text_watermark_ft:sonne text_catalogue_ft:sonne
> > text_index_ft:sonne text_tei_ft:sonne text_abstract_ft:sonne
> > text_pdf_ft:sonne","to":"parent_ids","traversalFilter":"class_s:meta
> > -type_s:multivolume_work -type_s:periodical -type_s:issue
> > -type_s:journal"}}]}}]}},"class_s:meta"]}},"to":"id"}}]}}}
> >
>
> --
> Jochen Barth * Universitätsbibliothek Heidelberg, IT * Telefon 06221
> 54-2580
>
>

-- 
Sincerely yours
Mikhail Khludnev

Re: facetting+tagging in JSON Query DSL

Posted by Jochen Barth <ba...@ub.uni-heidelberg.de>.
Oops.. my thunderbird did not preserve color...
the keywords to look for in the query are

»facet.field=%7B%21ex%3Dtype_s%7Dtype_s«
and
»{"#type_s":"type_s:article"}«

Kind regards, Jochen

Am 26.08.19 um 15:25 schrieb Jochen Barth:
> Dear reader,
>
> I'm trying to do this: 
> https://lucene.apache.org/solr/guide/8_1/faceting.html#tagging-and-excluding-filters 
>
>
> with JSON Query DSL: 
> https://lucene.apache.org/solr/guide/8_1/json-query-dsl.html#tagging-in-json-query-dsl
>
> here is the complete query - essential parts in red (see below):
>
> But it does not seem to work - has this perhaps to do with 
> bool:{should:[...]} in {filter:...}?
>
> Kind regards, Jochen
>
> start=0&rows=50&sort=sort_title_s%20asc&fl=id&facet=true&facet.mincount=1&facet.field=%7B%21ex%3Dtype_s%7Dtype_s&facet.field=meta_name_ss&facet.field=meta_periodical_title_s&facet.field=meta_subject_ss&facet.range=meta_date_dtrs&f.meta_date_dtrs.facet.range.start=0000-01-01T00%3A00%3A00Z&f.meta_date_dtrs.facet.range.end=2100-01-01T00%3A00%3A00Z&f.meta_date_dtrs.facet.range.gap=%2B1YEAR&json={"filter":[{"bool":{"should":[{"#type_s":"type_s:article"}]}}],"query":{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"graph":{"from":"parent_ids","query":"meta_title_txt:sonne 
> meta_name_txt:sonne meta_subject_txt:sonne 
> meta_shelflocator_txt:sonne","to":"id"}},{"graph":{"from":"id","query":"text_ocr_ft:sonne 
> text_heidicon_ft:sonne text_watermark_ft:sonne text_catalogue_ft:sonne 
> text_index_ft:sonne text_tei_ft:sonne text_abstract_ft:sonne 
> text_pdf_ft:sonne","to":"parent_ids","traversalFilter":"class_s:meta 
> -type_s:multivolume_work -type_s:periodical -type_s:issue 
> -type_s:journal"}}]}}]}},"class_s:meta"],"must_not":[{"join":{"from":"parent_ids","query":{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"graph":{"from":"parent_ids","query":"meta_title_txt:sonne 
> meta_name_txt:sonne meta_subject_txt:sonne 
> meta_shelflocator_txt:sonne","to":"id"}},{"graph":{"from":"id","query":"text_ocr_ft:sonne 
> text_heidicon_ft:sonne text_watermark_ft:sonne text_catalogue_ft:sonne 
> text_index_ft:sonne text_tei_ft:sonne text_abstract_ft:sonne 
> text_pdf_ft:sonne","to":"parent_ids","traversalFilter":"class_s:meta 
> -type_s:multivolume_work -type_s:periodical -type_s:issue 
> -type_s:journal"}}]}}]}},"class_s:meta"]}},"to":"id"}}]}}}
>

-- 
Jochen Barth * Universitätsbibliothek Heidelberg, IT * Telefon 06221 54-2580