Currently, like in D7, we extract the item data for indexing into the typical huge arrays, with settings keys ($item[#something']) used for passing the original object, datasource ID and item ID (and possibly other metadata later).
This should be switched to a proper OO implementation, using classed objects for each item, and for the fields contained within. The item object should have methods for retrieving the original object, datasource ID and item ID, as well as methods for getting/setting arbitrary metadata. Implementing Traversable might also be a good idea.
We might also look at whether it makes sense for the item class (resp. its interface – both classes should of course also have interfaces) to inherit from ComplexDataInterface, and the field class from TypedDataInterface.

Comments

das-peter’s picture

Assigned: Unassigned » das-peter

  • Commit 85e04ce on 2253237-search-result-class by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...
drunken monkey’s picture

Just a little reminder for everyone involved: while doing this, my fail in accounting for datasource-independent fields in Index::indexItems() (near the beginning of the method) should be fixed as well. Currently, tests for #2241429: Support translations are failing because they expose this error, but anyone trying to index anything with any datasource-independent field enabled will probably run into the same problem.

das-peter’s picture

Component: Backend » Framework
Assigned: das-peter » Unassigned

I'm not sure when I'm able to continue here - so unassigning me for now :|

drunken monkey’s picture

Status: Active » Closed (duplicate)

Ah, let's just discuss this in #2253237: Add proper classes for indexed items and search results, splitting doesn't make sense if it's going to be one commit anyways.

  • Commit 85e04ce on master, 2253237-search-result-class by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2 by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields, config-schema by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields, config-schema, transliteration by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields, config-schema, transliteration, ignore-case-test-fix by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields, config-schema, transliteration, ignore-case-test-fix, 2281233-fix-stopwords by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields, config-schema, transliteration, ignore-case-test-fix, 2281233-fix-stopwords, ignorecase-nick, renamefields by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2230925-server-tasks, 2235381-fix-config-schemas-2, 2257113-Index-Processors-Fields, config-schema, transliteration, ignore-case-test-fix, 2281233-fix-stopwords, ignorecase-nick, renamefields by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2235381-fix-config-schemas-2, config-schema, transliteration, ignore-case-test-fix, ignorecase-nick, renamefields, highlight by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2235381-fix-config-schemas-2, config-schema, transliteration, ignore-case-test-fix, ignorecase-nick, renamefields, highlight, add-aggregation-nick by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2235381-fix-config-schemas-2, config-schema, transliteration, ignore-case-test-fix, ignorecase-nick, renamefields, highlight, add-aggregation-nick, 2247923-Test_the_RenderedItem_processor by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • Commit 85e04ce on master, 2253237-search-result-class, 2235381-fix-config-schemas-2, config-schema, transliteration, ignore-case-test-fix, ignorecase-nick, renamefields, highlight, add-aggregation-nick, 2247923-Test_the_RenderedItem_processor, 2286813-fields-processor-plugin-base-test by das-peter:
    Issue #2252079: Switch to proper objects for extracted items
    Initial...

  • das-peter committed 85e04ce on add_aggregatedfield_test
    Issue #2252079: Switch to proper objects for extracted items
    Initial...