apostrophecms / apostrophecms/apostrophe

3.0: Multiple search issues

Open
#3,193 9 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## Describe the bug
1. The task `node app @apostrophecms/search:index` fails with `TypeError: self.indexDoc is not a function`
2. Pieces types are not registered programmatically as stated [in the source documentation](https://github.com/apostrophecms/apostrophe/blob/3.0/modules/%40apostrophecms/search/index.js#L37) even with explicit `searchable: true` settings.
3. I'm unable to include a desired field in the search index even via explicit `searchable: true` field option (tested with `string` textarea field type).
4. The implementation of `addSearchTexts` disallows any weight configuration, and there are valid cases when a specific area text field might be of type `highSearchText`. I haven't tested if the rich-text widgets are searchable yet, and the above is obviously not a bug.
5. The `silent` option for fields is not documented anywhere and it's unclear how it would affect the search. It's definitely not a part of the search result UI, my guess is it has something to do with API result set? (again not a search related bug report)

## Expected behavior
1. It looks to be a typo. `indexDoc` is defined in the `handlers` configuration and not in `methods`.
2. I'm unable to find a registered handler for the `determineTypes` event in the pieces source but only dedicated method `self.searchDetermineTypes(types)` which in turn is not invoked anywhere (but I might miss something here). The only way to enable a piece for a search is via the explicit `types` option of the search module.
3. There is a trace to this feature in the `schema` module (`indexFields` method) and `string` field type has a dedicated `index` method.

## Details

**Apostrophe*
v3.0.1*

Contributor guide

Open the contributing guide

Research direction

Start with the `node app @apostrophecms/search:index` entry point and the search module source at `modules/@apostrophecms/search/index.js`. Trace `indexDoc` in the handlers and methods configuration, then inspect `determineTypes`, `schema.indexFields`, and the string field's `index` method. Done means the reported indexing, type registration, field inclusion, and option documentation issues are resolved or clearly scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.