feat: suppress ES instant results when search-post-bodies is enabled
When searching inside comments is ON, the autocomplete dropdown now returns nothing from ES (only usernames show). This avoids showing title-only matches that are inconsistent with the full comment-body search results. Also passes filter[autocomplete]=1 to the API so the server uses the fast title.autocomplete path instead of the full has_child query.
This commit is contained in:
parent
33d4946947
commit
f7d9935fb9
|
|
@ -21,12 +21,18 @@ export default class DiscussionsSearchSource implements SearchSource {
|
||||||
private type = 'discussions';
|
private type = 'discussions';
|
||||||
|
|
||||||
async search(query: string): Promise<void> {
|
async search(query: string): Promise<void> {
|
||||||
|
// Suppress ES instant results when "search within comments" is ON;
|
||||||
|
// only usernames are shown in that mode.
|
||||||
|
if (app.forum.attribute('blomstraSearchPostBodies')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
query = query.toLowerCase();
|
query = query.toLowerCase();
|
||||||
|
|
||||||
this.results.set(query, []);
|
this.results.set(query, []);
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
filter: { q: query },
|
filter: { q: query, autocomplete: 1 },
|
||||||
page: { limit: 3 },
|
page: { limit: 3 },
|
||||||
include: 'mostRelevantPost',
|
include: 'mostRelevantPost',
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue