Skip to content

feat: FullTextSearch request includes portion of data to be retrieved from indexer - #62903

Open
madbob wants to merge 1 commit into
nextcloud:masterfrom
madbob:fts_portions
Open

feat: FullTextSearch request includes portion of data to be retrieved from indexer#62903
madbob wants to merge 1 commit into
nextcloud:masterfrom
madbob:fts_portions

Conversation

@madbob

@madbob madbob commented Aug 4, 2026

Copy link
Copy Markdown

Follow-up nextcloud/fulltextsearch#960


Right now, FTS platform fulltextsearch_elasticsearch returns an arbitrary set of data among those stored in the index, ignoring tags, subtags, metatags and more (pun intended).

It is fine to no fetch and pass everything all the time, but sometime a provider may find convenient to just reuse data already attached to a document instead of retrieve all of them from scratch.

Use case: I'm hacking a FTS provider for mail, and I have lots of structured data to index, to filter in search requests (e.g. from: filters), and to use while displaying the response (e.g. from can be used to retrieve the avatar of the message sender). Retrieve all of them again from the database (or, even worse: from the IMAP server) for each search result may become a bit inefficient.

Rationale of this proposal is to provide a method for the provider to specify (eventually in own implementation of IFullTextSearchProvider::improveSearchRequest()) the list of parts required back from the platform. A mere list of strings in SearchRequest, meant to be read and handled from the platform.

Sample implied implementation of changes in SearchMappingService::generateSearchQueryParams() (here):

$params = [
	'index' => $this->configService->getElasticIndex(),
	'size' => $request->getSize(),
	'from' => (($request->getPage() - 1) * $request->getSize()),
	'_source_excludes' => 'content',
	'_source_includes' => join(',', $request->getPortions()),   // <----- this line!
];

and SearchService::parseSearchEntry() also would require some adjustment (which I can provide myself if this is approved!).

@CarlSchwan CarlSchwan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread lib/public/FullTextSearch/Model/BodyPortion.php
Comment thread lib/public/FullTextSearch/Model/ISearchRequest.php Outdated
… from indexer

Signed-off-by: Roberto Guido <info@madbob.org>
* @since 35.0.0
*/
enum BodyPortion: string {
case TITLE = 'title';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need some phpdoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants