1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Future Fix Content search following Merge Users

Discussion in 'Future-Fix Bug Reports' started by Harpers Tate, Nov 19, 2013.

  1. Harpers Tate

    Harpers Tate Well-Known Member

    Two user accounts were merged in the AdminCP, because they belonged to the same person. (let's call them Member 1, Member 2 for example). Member 1 remains; Member 2 is deleted by the merge.

    Following this action, on the User Profile for Member 1, Postings Tab, link "Find all content by Member 1" the resultant list does NOT include content posted originally by Member 2.

    In the forum itself, an affected post DOES correctly show the Member 1 as the author.
    semprot, Mouth, Xon and 3 others like this.
  2. AndyB

    AndyB Well-Known Member

    Try rebuilding the search index:

    Admin CP -> Tools -> Rebuild Caches -> Rebuild Search Index -> Rebuild Now
  3. Mike

    Mike XenForo Developer Staff Member

    Rebuilding the search index would fix it, yes, but that's not exactly ideal.

    However, I'm not sure I see a particularly good way of fixing this, at least at scale. The problem is, every indexed content "owned" by a user needs to be changed to a new user. As search is designed to be very dynamic and add-on changeable, detecting this is tricky. In MySQL FT, we could run a query, but we can't do that with ES.

    I can see an approach to do this, but I'm not positive yet.
  4. AndyB

    AndyB Well-Known Member

    Wouldn't rebuilding the ES search index correct the problem?
  5. Mike

    Mike XenForo Developer Staff Member

    That was the first line of my comment. The rest relates to not doing that.
  6. AndyB

    AndyB Well-Known Member

    Hi Mike,

    Please explain why the ES search would not be updated when we rebuild the index. I assume the xf_post user_id and username information is correct, or is that the problem, the xf_post table is not updated?
  7. Jeremy

    Jeremy Well-Known Member

    Rebuilding it would fix it. As stated twice by the line above. But this is not the ideal fix, as it should update automatically allowing no manual interaction. ES functions differently in how it stores documents -- and that is the issue. It's not easy as saying "take all these documents and change this data too that".

    Rebuilding the search index takes ALL documents, throws them out and uses the updated information in the relative XF tables to construct a new index. This can be time consuming and not ideal for most boards.
  8. AndyB

    AndyB Well-Known Member

    Thank you for the clarification, Jeremy.

    Sorry Mike, for some reason when I read "would" in my mind I saw "wouldn't".
  9. Daniel Hood

    Daniel Hood Well-Known Member

    Couldn't you execute a search through the XenForo_Searcher class for all content by that user. If you modified it to loop through all the results and compile a list of content types/content ids, you should be able to update just those. It still might be somewhat time consuming but it seems like a perfect task for the deferred system. Since it's going through the XenForo_Searcher class, it should work with ElasticSearch too. ElasticSearch just may have to be modified to use the scan&scroll feature.

    [Edit] I just realized how old this thread is, sorry.
  10. Xon

    Xon Well-Known Member

    It still really isn't fixed, just had it occur when merging a bunch of duplicate accounts into a single account.
    semprot likes this.
  11. Xon

    Xon Well-Known Member

Share This Page