mirror of
https://github.com/flarum/core.git
synced 2025-07-29 20:50:28 +02:00
Improve fulltext search API and interface
This commit is contained in:
@@ -23,7 +23,10 @@ export default class DiscussionList extends Component {
|
||||
}
|
||||
params.sort = this.sortMap()[params.sort];
|
||||
if (params.q) {
|
||||
params.filter = params.filter || {};
|
||||
params.filter.q = params.q;
|
||||
params.include.push('relevantPosts', 'relevantPosts.discussion', 'relevantPosts.user');
|
||||
delete params.q;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ export default class DiscussionsSearchResults {
|
||||
|
||||
search(string) {
|
||||
this.results[string] = [];
|
||||
return app.store.find('discussions', {filter: {q: string}, page: {limit: 3}, include: 'relevantPosts,relevantPosts.discussion'}).then(results => {
|
||||
return app.store.find('discussions', {filter: {q: string}, page: {limit: 3}, include: 'relevantPosts,relevantPosts.discussion,relevantPosts.user'}).then(results => {
|
||||
this.results[string] = results;
|
||||
});
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ export default function(string, phrase, length) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const regexp = regexp instanceof RegExp ? phrase : new RegExp(phrase, 'gi');
|
||||
const regexp = phrase instanceof RegExp ? phrase : new RegExp(phrase, 'gi');
|
||||
|
||||
let highlightedString = string;
|
||||
let start = 0;
|
||||
|
Reference in New Issue
Block a user