nextcloud / nextcloud/fulltextsearch

Bug: Partial search fails as app ignores 'analyzer' and 'search_fields' settings (v32.0.0)

Open
#940 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
PHP
Stars
234
Forks
64
Avg merge
6h 18m
Merged PRs (30d)
10

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce
Install Nextcloud 32.0.1.2 with fulltextsearch apps (v32.0.0).

Set up an Elasticsearch 8.x container.

Create an advanced index template in Elasticsearch that uses an n-gram analyzer for partial search (e.g., nc_partial_analyzer).

Configure Nextcloud to use this index and analyzer by setting:

fulltextsearch_elasticsearch index = nextcloud_smart_search (our custom index)

fulltextsearch search_fields = ["content^3", "content.partial"]

fulltextsearch analyzer = (empty, to use the index's default_field)

Run a full index with php occ fulltextsearch:index.

Try to search for a partial term (e.g., "nndc") from the web UI.

Expected behaviour
The fulltextsearch app should build a query that searches the content and content.partial fields for the term "nndc". The search should return the files that contain this partial string.

Actual behaviour
The search from the web UI fails and returns "No results."

The debug nextcloud.log shows that the fulltextsearch app is sending an empty query to Elasticsearch. The search term "nndc" is missing from the query body.

This is the most important log line:

JSON

{
"reqId": "hgQeFUIMJhx11uMQ5BSd",
"level": 0,
"app": "fulltextsearch_elasticsearch",
"method": "GET",
"url": "/ocs/v2.php/search/providers/fulltextsearch/search?term=nndc",
"message": "Searching ES",
"data": {
"app": "fulltextsearch_elasticsearch",
"params": "{"index":"nextcloud_smart_search","size":5,"from":0,"_source_excludes":"content","body":{"query":{"bool":{"must":[],"filter":[]}}}}"
}
}
As you can see, the "must":[] array is empty.

This proves the bug is in the Nextcloud app:

A direct curl test to the same index (nextcloud_smart_search) WORKS and finds the file.

The app's own command (occ fulltextsearch:search "ching" "nndc") also FAILS and returns * files: (0 results).

The app is not reading its configuration and is not passing the search term to Elasticsearch.

Server configuration
Web server: Apache (Official Nextcloud Docker Image)

Database: MariaDB

PHP version: (Included with official Nextcloud 32.0.1.2 Docker Image)

Nextcloud version: 32.0.1.2

List of activated apps

(Please run this command in your console and paste the output here)

su -s /bin/bash www-data -c 'php occ app:list'

Nextcloud configuration

(Please run this command in your console and paste the output here)

su -s /bin/bash www-data -c 'php occ config:list system'
FullTextSearch App Configuration:

$ su -s /bin/bash www-data -c 'php occ config:app:get fulltextsearch platform'
OCA\FullTextSearch_Elasticsearch\Platform\ElasticsearchPlatform

$ su -s /bin/bash www-data -c 'php occ config:app:get fulltextsearch_elasticsearch index'
nextcloud_smart_search

$ su -s /bin/bash www-data -c 'php occ config:app:get fulltextsearch search_fields'
["content^3", "content.partial"]

$ su -s /bin/bash www-data -c 'php occ config:app:get fulltextsearch analyzer'
(This is empty / not found)

Browser
Browser name: Microsoft Edge

Browser version: 142

Operating system: Windows 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the web UI and the php occ fulltextsearch:search entry point using the reported search_fields and index settings. Trace how the fulltextsearch app builds the Elasticsearch request and reads these settings. Done means the generated query contains the search term and configured fields, and partial searches return matching files.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, php
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.