collective / collective.solr

Solr search engine integration for Plone
https://pypi.org/project/collective.solr/
22 stars 46 forks source link

Removing SearchableText from portal_catalog yields to plone.restapi warning #193

Open sauzher opened 6 years ago

sauzher commented 6 years ago

When using collective.solr 5.0.3 it is safe, as suggested, to remove SearchableText from portal_catalog and free up a lot of memory footprint.

With collective.solr 6.0a2 (as well as master branch), every search logs: WARNING plone.restapi.search.query No such index: 'SearchableText

tisto commented 6 years ago

@sauzher can you please elaborate?

sauzher commented 6 years ago

Doc, reports:

[using solr...] also reduce the memory footprint of your Plone instance by allowing you to remove the SearchableText, Description and Title indexes from the catalog.

After 5.0.3, c.solr uses plone.restapi to make searches but, if you do actually remove SearchableText from portal_catalog, eventlog reports WARNING plone.restapi.search.query No such index: 'SearchableText for every search.

This warning does not affect the search itself, it simply pollutes the event log without a real reason.

Perhaps it is related to plone.restapi rather than c.solr.

thanks, alessandro.

tisto commented 6 years ago

@sauzher do you have a real URL as a pointer?

sauzher commented 5 years ago

@tisto I apologize, but I didn't get what do you asking for :-/

tisto commented 5 years ago

@sauzher a URL that points to what you cite in "Doc, reports".

sauzher commented 5 years ago

@tisto https://github.com/collective/collective.solr#current-project-status

tisto commented 5 years ago

@sauzher thank you! :) Could you provide me with the full trace and maybe add a pointer to the code in c.solr/p.restapi that raises that warning? I am happy to help with this but I am rather busy these days...

sauzher commented 5 years ago

It's a warning, so I've no a real traceback to provide but this: 2018-09-24 10:37:43 WARNING plone.restapi.search.query No such index: 'SearchableText'

Here it is the call done by c.solr:

and here it is where the warning is fired by plone.restapi:

A little analysis, HTH the plone.restapi.search.query.ZCatalogCompatibleQueryAdapter.__call__() method cycles on all indexes in the query parameter and tries to adapt each with IIndexQueryParser to normalize all possible incoming values. A missing 'SearchableText' in the catalog yields to jump this normalizing process avoiding the "could not adapt" error and logging the warning.

Now the search process still works, because the SearchableText value is always of type of a simple string and it remains unaltered in the query dict passing throught to the catalog.searchResluts(), as well as to Solr.

@tisto You're very welcome :)

sauzher commented 4 years ago

I partially solved adding a fake index to the catalog

index: SearchableText (indexed attributes: FAKE_SearchableText)

In this (dirty) way, the index is kept free of data, and the restapi is pleased to find an index with that name before committing the search.

sauzher commented 3 years ago

Perpahs https://github.com/plone/plone.restapi/pull/1087 fixes this #193 too... I will check asap.