Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary SearchableText metadata #232

Closed
idgserpro opened this issue Aug 21, 2020 · 8 comments · Fixed by #239
Closed

Unnecessary SearchableText metadata #232

idgserpro opened this issue Aug 21, 2020 · 8 comments · Fixed by #239

Comments

@idgserpro
Copy link
Member

There is an unnecessary SearchableText metadata:

This probably makes the catalog grow unnecessarily.

@idgserpro
Copy link
Member Author

@mauritsvanrees if an upgrade step is make to remove this metadata, is it necessary to do a clear and rebuild in the catalog?

@mauritsvanrees
Copy link
Member

Yes.

Or you can do something like this (not tried):

for brain in catalog.unrestrictedSearchResults():
    obj = brain.getObject()
    catalog.catalog_object(obj, idxs=["id"]

This recatalogs the item, but only reindexes a single, cheap index: the id index (assuming this exists).

Depending on which Products.ZCatalog version this is, you may be able to use catalog.getAllBrains(), which would be better. See collective/collective.catalogcleanup#24 for some code.

@idgserpro
Copy link
Member Author

Thanks!

@hvelarde
Copy link
Member

I don't think that's unnecessary.

@idgserpro
Copy link
Member Author

idgserpro commented Aug 24, 2020

@hvelarde for body text:

<p>Content of nitf</p>
<p>test content</p>
<p><strong>text strong</strong></p>

we have the SearchableText metadata:

title-of-nitf Title of nitf Description of nitf Content of nitf test content text strong

In what situation can we use this metadata? Doesn't collective.nitf use it anywhere. And for files, it can be really big, making the catalog big, and making indexing take longer.

@idgserpro
Copy link
Member Author

@hvelarde sorry. In comment above I had put the SearchableText index. Now I fix it for metadata. Anyway, still find it unnecessary.

@hvelarde
Copy link
Member

IIRC, this is necessary to include all metadata of an instance of this content type in the index. check the code and you'll find the subtitle, the byline, the location and many other attributes.

@idgserpro
Copy link
Member Author

@hvelarde I think you're mixed. I'm talking about the SearchableText metadata (column) and not of SearchableText index. The SearchableText index:

('SearchableText', 'ZCTextIndex'),

Is important and must be maintained. It really serves to group several fields in a single index.

But the SearchableText metadata (column):

Is not necessary.

For exemple:

>>> from plone import api
>>> results = api.content.find(SearchableText='Text') # This uses the SearchableText index and is important
>>> brain = results[0]
>>> brain.SearchableText # This is the SearchableText metadata and is unnecessary. Where will we use the string below?
u'title-of-nitf Title of nitf  Description of nitf   Content of nitf \r\n test content \r\n text strong   

It is possible to have the SearchableText index without having the SearchableText metadata. I removed the SearchableText metadata and run the tests. All tests passed.

idgserpro added a commit that referenced this issue Apr 14, 2021
To make review easier after running since it can modify thousands of objects.

(complements #232)
idgserpro added a commit that referenced this issue Apr 14, 2021
To make review easier after running since it can modify thousands of objects.

(complements #232)
idgserpro added a commit that referenced this issue Apr 14, 2021
To make review easier after running since it can modify thousands of objects.

(complements #232)
idgserpro added a commit that referenced this issue Apr 14, 2021
To make review easier after running since it can modify thousands of objects.

Available at Undo tab in / in the ZMI.

(complements #232)
idgserpro added a commit that referenced this issue Apr 15, 2021
To make review easier after running since it can modify thousands of objects.

Available at Undo tab in / in the ZMI.

(complements #232)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants