Add dependency to xwiki-platform-search-api to the war

Hi everyone,

Following XWIKI-21699: Add new API to help evaluate xobjects · xwiki/xwiki-platform@742cd45 · GitHub, the UI component searchSuggest.js requires the module xwiki-platform-search-api to work properly.
A consequence of this change is Loading... : during an upgrade process, the logs display that the ObjectEvaluator is missing in the runtime environment.
While this does not impact the upgrade process itself (thanks to XWIKI-21744: Errors related to ObjectEvaluator after upgrading to 15.… · xwiki/xwiki-platform@d7e90c1 · GitHub), having these logs is obviously an issue. Currently, I see three ways to fix it:

  • add the missing dependency to xwiki-platform-distribution-war-dependencies
  • add the missing dependency to xwiki-platform-minimaldependencies
  • complete exception handling to searchSuggest.js with logback rules to mute these logs during upgrade

Right now, I am not sure of what all the uses of xwiki-platform-minimaldependencies are, but solution 2 seems to be the best since it’s the module that includes the UI components.

WDYT?

I’ll answer generically: we need to work towards reducing the size of the minimal XWiki WAR, so any addition of new deps to xwiki-platform-minimaldependencies is a technical debt for the future. On the topic of search, we would need to work so that the search feature becomes an extension in the sense that XWiki should work without it and it should be installable on top of a minimal xwiki instance. I don’t know if it’s the case today or not, nor how much work it’d be to refactor it.

Note that xwiki-platform-minimaldependencies is what is used for our functional tests (then the module being tested can have deps which will be installed as extensions on top of it).

PS: I’m not saying that adding to xwiki-platform-minimaldependencies is not the best solution (without refactoring anything). I have no idea. My answer is there to explain that we need to try as much as possible to reduce the minimal war and not add to it, or we’ll have failed in making XWiki a runtime dev platform.

The link you provided shows this:

#set ($evaluatedSource = $source.evaluate())

The evaluate method is from the standard xobject API provided by oldcore, so this code doesn’t depend technically on xwiki-platform-search-api. It’s just that xwiki-platform-search-api provides an implementation of ObjectEvaluator. The question is: should the minimal WAR force a specific implementation for the APIs used in it. The answer needs to be yes if we want to have a functioning minimal WAR (otherwise it’s not the minimal WAR anymore). So I think we have two options:

  • keep searchSuggest.js inside the minimal WAR and add a dependency to xwiki-platform-search-api
  • or move searchSuggest.js outside the minimal WAR (inside the search module, e.g. xwiki-platform-search-webjar) and add the dependency to xwiki-platform-search-api there. This probably needs some refactoring though.

Hope this helps,
Marius