alkacon / opencms-core

The Java open source content management system by Alkacon Software
http://www.opencms.org
GNU Lesser General Public License v2.1
520 stars 575 forks source link

filter query "search_exclude" is set again even if set before #764

Closed tobias-karrer closed 9 months ago

tobias-karrer commented 1 year ago

Query param &fq=search_exclude:"false" will be set in CmsSolrIndex#search() even if CmsSolrQuery query passed already contains the param.

There should be a check if already set before adding it here: https://github.com/alkacon/opencms-core/blob/master/src/org/opencms/search/solr/CmsSolrIndex.java#L882

gWestenberger commented 9 months ago

This is the intended behavior.

tobias-karrer commented 9 months ago

This is the intended behavior.

Really?!? Queries like &fq=search_exclude:"false"&fq=search_exclude:"false"&fq=search_exclude:"false" ... are intented?

gWestenberger commented 9 months ago

It adding fq=search_exclude:"false", regardless of whether there is already another parameter fq=search_exclude:"xyz" or fq=-search_exclude:"xyz", is the intended behavior.

You only end up with your example &fq=search_exclude:"false"&fq=search_exclude:"false"&fq=search_exclude:"false" if you reuse a query object for multiple searches, so I suggest you don't do that.

tobias-karrer commented 9 months ago

I do so to search in batches (where only "start" changes), as the search is limited to 400 resources. Increasing maxProcessedResults is in parts possible, but does not help everywhere. Rebuilding the whole query would not be effective.

As workaround I now remove the filter query for "search_exclude" before searching again. But it would be better if CmsSolrIndex.java wouldn't set it multiple times.

gWestenberger commented 9 months ago

Good point. Done.