Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-24099

eZ Find not updating Solr index correctly for object relations

    XMLWordPrintable

Details

    Description

      The main problem is the following which is solved partially by EZP-22859. When you have two objects, let's call them Parent and Child.
      The Parent object has an objectrelationlist attribute. We add Child objects to that relation list.

      We then index these objects in Solr and if we search for Parent filtered by the object relation list containing Child objects it works correctly until the linked Child object is changed.

      The search does a text search for the "title" attribute of the Child object which we just changed and hence it will not match anymore. The problem here is that the objectrelationlist datatype is still referencing the old version of the linked object and the indexing process is getting the old metadata.

      This was actually pointed out on ticket EZP-22859 as one of the last comments (https://jira.ez.no/browse/EZP-22859?focusedCommentId=101881&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-101881).

      A possible solution was to do the following:
      To patch the kernel/classes/datatypes/ezobjectrelationlist/ezobjectrelationlisttype.php file at line 1568 with the suggestion from fassino's comment. (See attached patch file)

      We also created a new workflow event to run for the above mentioned "Sector" object to get all reverse related objects and reindex them through the ezpending_actions database table and the indexcontent cronjob. Otherwise a full reindex run through eZ Find's updatesearchindexsolr.php script is required to index the changes correctly.


      *Steps to reproduce:*

      1. Create a "Parent" class with the following settings:
      Name: Parent
      Class identifier: parent
      Object name pattern: <title>
      Attributes:
      a. Name: Title
      Identifier: title
      Type: Text line
      b. Name: Children
      Identifier: children
      Type: Object Relations

      2. Create a Child class with the following settings:
      Name: Child
      Class identifier: child
      Object name pattern: <title>
      Attributes:
      a. Name: Title
      Identifier: title
      Type: Text line

      3. Create an object of Child. Set title to "Test child"
      4. Create an object of Parent and add Child in the object relation list
      5. Index the site in Solr
      6. On the Solr admin interface do the following query

      http://[url to solr admin]select?q=*%3A*&fq=attr_+children_t%3A%3D"Test+child"&fq=meta_class_identifier_ms%3A%3D"parent"&fl=attr_title_t&wt=json&indent=true&qt=ezpublish
      

      This should return one result, the Parent object created on step 4.

      7. Change the title of Child to "Something something"
      8. Reindex the site
      9. Execute the following in the Solr admin

      select?q=*%3A*&fq=attr_+children_t%3A%3D"Something+something"&fq=meta_class_identifier_ms%3A%3D"parent"&fl=attr_title_t&wt=json&indent=true&qt=ezpublish
      

      No results will be returned

      10. Apply attached patch to legacy kernel
      11. Reindex site
      12. Execute query from step 9.
      There should be 1 result

      Attachments

        Activity

          People

            Unassigned Unassigned
            ricardo.correia-obsolete@ez.no Ricardo Correia (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: