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/12/04 12:42:09 UTC

WITHDRAWN! Re: q.op=AND vs default (q.op=OR)

Mea culpa ...
ran the different queries against two different solr instances.

Everything works fine.

Kind regards,
Jochen



Am 04.12.19 um 13:20 schrieb Jochen Barth:
> Found
> https://cwiki.apache.org/confluence/display/lucene/BooleanQuerySyntax
>
> But this does not explain the problem...
>
> Oh... and there is a bug in the abbreviated queries: the X behind the 
> second _g_dn should be Y - but this does not affect the further 
> AND/OR/+/- query structure.
>
> Jochen
>
>
> Am 04.12.19 um 12:39 schrieb Jochen Barth:
>> Dear reader, I'm using solr 8.1.1.
>>
>> I'm trying to switch from q.op=OR to q.op=AND, because of the parser 
>> I generate the queries for solr is somewhat more simple to develop 
>> with q.op=AND.
>>
>> but the new query is returning less hits;
>>
>> I have shortened the query string for better readability; _g_up 
>> stands for »from=id to=parent_ids«, _g_dn stands for »from=parent_ids 
>> to=id«,
>>
>> _tft stands for »-type_s:multivolume_work -type_s:periodical 
>> -type_s:issue -type_s:journal«
>>
>> and I have dropped some lenghty query terms (e. g. text_tei_ft, 
>> text_abstract_ft, meta_title_txt, meta_name_txt, ...) (for readability)
>>
>> here the original query without q.op=AND
>>
>> q=_query_:"{!graph _g_up}filter(+((_query_:\"{!graph 
>> _g_dn}meta_subject_txt:X meta_shelflocator_txt:X\" _query_:\"{!graph 
>> traversalFilter=\\\"class_s:meta _tft\\\" _g_up}text_ocr_ft:X 
>> text_pdf_ft:X\") (_query_:\"{!graph _g_dn}meta_subject_txt:X 
>> meta_shelflocator_txt:X\" _query_:\"{!graph 
>> traversalFilter=\\\"class_s:meta _tft\\\" _g_up}text_ocr_ft:X 
>> text_pdf_ft:X\") ) +class_s:meta )"
>>
>> here the new query with q.op=AND:
>>
>> q=_query_:"{!graph _g_up}filter(((_query_:\"{!graph 
>> _g_dn}meta_subject_txt:X OR meta_shelflocator_txt:X\" OR 
>> _query_:\"{!graph traversalFilter=\\\"class_s:meta _tft\\\" 
>> _g_up}text_ocr_ft:X OR text_pdf_ft:X\") OR (_query_:\"{!graph 
>> _g_dn}meta_subject_txt:X OR meta_shelflocator_txt:X\" OR 
>> _query_:\"{!graph traversalFilter=\\\"class_s:meta _tft\\\" 
>> _g_up}text_ocr_ft:X OR text_pdf_ft:X\") ) class_s:meta )"
>>
>>
>> for comparison, the whole (unshortened) query as by debug=query from 
>> solr;
>>
>> whitout q.op=AND:
>>
>> # parsedquery: "GraphQuery([[filter(+(([[meta_title_txt:\"h 
>> schliemann\" meta_name_txt:\"h schliemann\" meta_subject_txt:\"h 
>> schliemann\" meta_shelflocator_txt:\"h 
>> schliemann\"],parent_ids=id][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false] 
>> [[meta_title_txt:\"h schliemann\" meta_name_txt:\"h schliemann\" 
>> text_ocr_ft:\"h schliemann\" text_heidicon_ft:\"h schliemann\" 
>> text_watermark_ft:\"h schliemann\" text_catalogue_ft:\"h schliemann\" 
>> text_index_ft:\"h schliemann\" text_tei_ft:\"h schliemann\" 
>> text_abstract_ft:\"h schliemann\" text_pdf_ft:\"h 
>> schliemann\"],id=parent_ids] [TraversalFilter: class_s:meta 
>> -type_s:multivolume_work -type_s:periodical -type_s:issue 
>> -type_s:journal][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false]) 
>> ([[meta_title_txt:\"henry schliemann\" meta_name_txt:\"henry 
>> schliemann\" meta_subject_txt:\"henry schliemann\" 
>> meta_shelflocator_txt:\"henry 
>> schliemann\"],parent_ids=id][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false] 
>> [[meta_title_txt:\"henry schliemann\" meta_name_txt:\"henry 
>> schliemann\" text_ocr_ft:\"henry schliemann\" 
>> text_heidicon_ft:\"henry schliemann\" text_watermark_ft:\"henry 
>> schliemann\" text_catalogue_ft:\"henry schliemann\" 
>> text_index_ft:\"henry schliemann\" text_tei_ft:\"henry schliemann\" 
>> text_abstract_ft:\"henry schliemann\" text_pdf_ft:\"henry 
>> schliemann\"],id=parent_ids] [TraversalFilter: class_s:meta 
>> -type_s:multivolume_work -type_s:periodical -type_s:issue 
>> -type_s:journal][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false])) 
>> +class_s:meta)],id=parent_ids][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false])" 
>>
>>
>> with q.op=AND:
>>
>> # parsedquery: "+GraphQuery([[+filter(+(([[meta_title_txt:\"h 
>> schliemann\" meta_name_txt:\"h schliemann\" meta_subject_txt:\"h 
>> schliemann\" meta_shelflocator_txt:\"h 
>> schliemann\"],parent_ids=id][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false] 
>> [[meta_title_txt:\"h schliemann\" meta_name_txt:\"h schliemann\" 
>> text_ocr_ft:\"h schliemann\" text_heidicon_ft:\"h schliemann\" 
>> text_watermark_ft:\"h schliemann\" text_catalogue_ft:\"h schliemann\" 
>> text_index_ft:\"h schliemann\" text_tei_ft:\"h schliemann\" 
>> text_abstract_ft:\"h schliemann\" text_pdf_ft:\"h 
>> schliemann\"],id=parent_ids] [TraversalFilter: +class_s:meta 
>> -type_s:multivolume_work -type_s:periodical -type_s:issue 
>> -type_s:journal][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false]) 
>> ([[meta_title_txt:\"henry schliemann\" meta_name_txt:\"henry 
>> schliemann\" meta_subject_txt:\"henry schliemann\" 
>> meta_shelflocator_txt:\"henry 
>> schliemann\"],parent_ids=id][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false] 
>> [[meta_title_txt:\"henry schliemann\" meta_name_txt:\"henry 
>> schliemann\" text_ocr_ft:\"henry schliemann\" 
>> text_heidicon_ft:\"henry schliemann\" text_watermark_ft:\"henry 
>> schliemann\" text_catalogue_ft:\"henry schliemann\" 
>> text_index_ft:\"henry schliemann\" text_tei_ft:\"henry schliemann\" 
>> text_abstract_ft:\"henry schliemann\" text_pdf_ft:\"henry 
>> schliemann\"],id=parent_ids] [TraversalFilter: +class_s:meta 
>> -type_s:multivolume_work -type_s:periodical -type_s:issue 
>> -type_s:journal][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false])) 
>> +class_s:meta)],id=parent_ids][maxDepth=-1][returnRoot=true][onlyLeafNodes=false][useAutn=false])" 
>>
>>
>> wdiff of both:
>>
>> "GraphQuery([[filter(+(([[meta_title_txt:\"h"+GraphQuery([[+filter(+(([[meta_title_txt:\"h 
>> ... [TraversalFilter:class_s:meta  +class_s:meta 
>> -type_s:multivolume_work ... [TraversalFilter:class_s:meta 
>> +class_s:meta  -type_s:multivolume_work
>>  ...
>>
>> so the + before the »filter(« shouldnt be strictly necessary nor be 
>> the problem,
>>
>> and the + efore class_s:meta isn't necessary, too, but can't be the 
>> problem, too, in my opinion.
>>
>>
>> What I found out is, that, "+" and "-" have higher precedence than 
>> "AND" and "OR"... but I don't see my error...
>>
>> Does someone has a hint for me?
>>
>>
>> Kind regards,
>>
>> Jochen
>>
>>
>
> -- 
> Jochen Barth * Universitätsbibliothek Heidelberg, IT * Telefon 06221 54-2580


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