-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[com_finder] Error in reindex when category state change #9346
Conversation
When the category access change it was reindex with the category id instead of the item id.
@miguelbgouveia can you make more clear test instrutions? For instance, i've never used com_finder before and have no idea what this PR is supposed to do and how to test it. |
The com_finder is used to create a index of words in order to use it in smart search way. We start writing some letters in the search filed and the smart search show some possible words that the user can chose. The words are from the previous index created. To index is created based in the data associated to the com_finder. For example: articles, contacts, etc, can be associated to the smart search. For each type of item we have to activate the corresponding plugin. When there is some change in the items to index there is some events that fire and that are responsible to actualize the index. One of that cases is when we change the state of a category of one of those elements. The problem founded here was that when we change the state of category of a item that is in the index, the function that handle this change was not working correctly. This function should reindex all the items related to the category but by mistake it was taken the wrong identifier of the items. Instead of taken the item identifier to reindex, it was taken the category identifier. To test this you should create, for example, an article with the state published, with a specific word in is title (for example 'word_to_index') and associate it to a category that also as the state state published. Then try to find the article using the word 'word_to_index' in the main search field. It should show the article in the search results. Now try to unpublished the article and make the same search. You will see that the article still appear but it shouldn't. After make this correction and repeating all the steps described before, the article with the unpublished state will not appear this time. Note: You should change the article category state in the edit form in the administration site. You have to also change the category access beside with the state change in order to fire the reindex of the items. This is another problem with this component that I will try to correct later. |
ok thanks for the explanation and test instructions, will test when i have time |
I have tested this item 🔴 unsuccessfully on cd5ee81
|
The result of your test are very strange because you are testing the change state of the article and I only change the change state of the category of the article. To test my pull request you should change the state of the category "Category com_finder" from published to unpublished and not the state of the article. Nevertheless, I will simulate your test, but it must pass because was not the part of the code that I change. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
sorry you are right, i was with cache enabled .... |
The test should be:
|
Used 3.5.0 RC for the tests. i think i see what you mean now, you have to change the category published status to unpublished on the edit page to detect the problem (not the button or checkbox in the list view, that already worked fine), but with or without your patch the behaviour is the same, in other words, doesn't remove it from the search results list. |
Whilst this PR certainly looks correct, fixing it might serve to highlight a performance issue. If you publish/unpublish a category containing a lot of articles (where "a lot" depends on the server specifications) or many particularly large articles (with a similarly vague definition of "many" and "particularly large") you could be waiting a long time for a response. In some cases the PHP process may time-out before it completes. I'm not saying we shouldn't fix it though. :-) |
Try to change the access filed at the same time as you change the state to unpublished. I think in this way may patch will work. As I said before: "You should change the article category state in the edit form in the administration site. You have to also change the category access beside with the state change in order to fire the reindex of the items. This is another problem with this component that I will try to correct later." In resume, my patch only resolve part of the problem. So the tests should be:
|
You right @chrisdavenport. But I think who use this plugin must have the information that the system could lose in performance. But that doesn't mean that we should not resolve the errors. |
I have tested this item ✅ successfully on cd5ee81 IMHO, a PR like this should solve the whole issue, in other words, also solve the fact that is not reindexing when we only change the state of the category (in edit view). This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
Not sure if you will find it useful or not, but some years ago I tried to put together a test plan for Smart Search which would establish the expected behaviour. Your PR reminded me of it. https://docs.joomla.org/Smart_Search_content_change_test_plan |
I create this PR because is was an error with an easy correction. I known that there is more work to do to correct all the management of category state change in the smart search. The problem is having time and knowledge to do the work, but I can try. In your opinion @andrepereiradasilva, if I resolve the others issues you think is better to add new code to this PR or create another one? |
Thanks @chrisdavenport for the information. But this test plan was accepted by the majority of the joomla community or it is some plan that where not been validated? Is a good idea use this plan to guide me to the process of the smart search correction? |
IMHO for the edit published state case problem to this PR. Other call have their PR. |
@miguelbgouveia I wouldn't say it has any "official" status, whatever that means, but if you were to run through it and find a discrepancy I think it would be worth opening an issue in the tracker so it can be discussed. But as @andrepereiradasilva said, let's not cloud this issue. This PR just needs one more test. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
This lasted changes is to correct a new founded problem. When we have a content belonging to a category that have more than one hierarchy level, when the state of the categories of the upper levels are changed this change have to be propagated to the contents belonging to the lower levels categories. To test this we can create an hierarchy of categories with tree levels. For example: category 1, category 1.1 and category 1.1.1, all with the state equal to publish. Then create a content with the state equal to publish and in the category 1.1.1. The content must be created with a specific characters in the title, for example xyz. If we insert the xyz characters using the smart search the content should appear in the results. Changing the category 1 state to unpublished and searching again by the xyz characters the content now should not appear in the search results. We should test this scenario using the two category state editing mods. Changing the category sate in the list of categories and using the category edit form. |
I have tested this item ✅ successfully on fcfc51e This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
I have tested this item 🔴 unsuccessfully on fcfc51e followed the test steps with article and contact categories. Pre-Patch search finds the article/contact. After apply patch and changing the state to unpublished the article/contact still appears in the search results. Only after a reindexing it disappears from the search results. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
I have tested this item 🔴 unsuccessfully on fcfc51e This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9346. |
@miguelbgouveia Can you update your PR please so the conflicts are fixed and we can test again? Thanks |
Necessary to build the query for update the category state when there are more than a level in the categories hierarchy.
Now I think is ready to test. The problem was added in the last commit that I was made. |
you need to fix the conflicts |
@andrepereiradasilva, how can I see where are the conflicts? |
You can do it in a git cli interface, Github for Windows. Search the web. Or you can manually check the recent history of the files you changed to see what changed and replicate those changes. The bottom line is you need to fix conflicts and update your |
Do you know how to use git e.g. a local client via command line? git checkout |
@zero-24 I try git pull [email protected]:/joomla/joomla-cms.git staging but I get this error:
|
Use |
Did you enter you password correct? Maybe you can also try git pull upstream staging |
Are you sure @mbabker as it works for me without push acccess to the upstream cms repo. |
If you've got your full SSH environment set up right then generally it will. For read only operations though, you really don't need it and can get away with the |
https://help.github.com/articles/which-remote-url-should-i-use/ Thanks just found it. |
@miguelbgouveia is this PR still for testing? |
I'm not more working with joomla CMS and I can't verify the correctness of this PR. |
As this PR has been abandoned by the submitter and it is not testable or mergable I am going to have to close it at this time. It can always be reopened if updated |
Pull Request for Issue # .
Summary of Changes
Testing Instructions
When the category state of a content change it was not propagated to the index of the smart search.