Currently, there is no way (without circumventing the framework) to keep a search query from executing all associated preprocessors, hooks, etc., when executing a query. This is sometimes not desired, e.g., when executing a search for internal purposes (I mostly think of saved searches here, but there are of course others). You don't want facets, etc., for those. In some cases, even running the processors on the query will be undesired.
To support this better in the framework, I suggest adding a "processing level" setting (probably via methods, not just as a normal query option) to search queries, with the following settings:
- Full query (default)
- As we do now, just call all enabled preprocessors (possibly taking into account the changes of #2044311: Change workflow plugin system, of course) and invoke the query alter hook before searching, then postprocess afterwards.
- Basic query
- Basic processing on the query (lowercase, stopwords, etc.) should still happen, but "extra features" should be skipped – those "features" being responsible for whether they should ignore this query or not. For example, facets, spellchecking and highlighting should probably all be skipped for this level.
For processors, it might be a good idea to provide an annotation property for this (skip_basic = trueor similar) to a) easily specify this and b) make it instantly clear for developers looking at the processor. - None
- Completely bypass any (non-required) pre- and postprocessing – i.e., don't use any processors and also skip all hooks (I think).
There will have to be extensive documentation for this so developers will have a good understanding of what setting a certain processing level will actually mean.
I don't think we can really make this extensible, since processors and contrib modules will have to know which levels to expect, but those three should at least be a large improvement.
Estimated Value and Story Points
This issue was identified as a Beta Blocker for Drupal 8. We sat down and figured out the value proposition and amount of work (story points) for this issue.
Value and Story points are in the scale of fibonacci. Our minimum is 1, our maximum is 21. The higher, the more value or work a certain issue has.
Value : 2
Story Points: 13
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2134803-10--processing_level.patch | 4.88 KB | drunken monkey |
Comments
Comment #1
nick_vhComment #2
drunken monkeyComment #3
drunken monkeyHere is a patch that should do this. As discussed, the "Highlight" processor skips "basic" queries. Anything else in this module that should do that?
I'd also be glad about reviews of the documentation, whether that's clear enough already.
Comment #4
borisson_This looks pretty good, I only found one small thing.
can we use
$query->getPrcoessingLevel < QueryInterface::PROCESSING_FULL, this might make more sense?Comment #5
drunken monkeyComment #6
drunken monkeyNot sure about that. We don't really "guarantee" anywhere that "full" will have the highest numeric value, so I'd say that proper use of the constants doesn't involve such comparisons.
But thanks for the review, in any case!
Comment #7
borisson_Ok, makes sense.
Comment #9
drunken monkeyGood to hear you agree.
Then: committed.
Thanks again for reviewing!
Comment #10
drunken monkeyI actually forgot the whole point of the exercise, or at least a significant part of it.
Comment #11
borisson_Back to NW for sqlite fails.
Comment #12
drunken monkeyCan't reproduce those locally. Re-attaching the same patch from #10.
Comment #13
drunken monkeyLooks good.
Is this otherwise RTBC in your opinion, Joris?
Comment #14
borisson_yes
Comment #16
drunken monkeyOK, thanks!
Committed.