-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata #31
Comments
You should define which data you want to have in metadata in the Server side. SearchSource.defineSource('meals', function(searchText, options){
var options = options ? options : {sort: {_id: -1}, limit: 5};
var selector = {}
if (searchText){
var regExp = buildRegExp(searchText);
selector = {$or: [
{title: regExp},
{description: regExp}
]};
}
var query = Tours.find(selector, options);
return {
data: query.fetch(),
metadata: {count: query.count()}
}
});
... |
@Kostanos: That worked perfect for me. Thanks. |
+1 @Kostanos |
+1 @Kostanos Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I tried to use the API getMetadata to get the number of results for a certain search but I can get it working. Could you provide a working example?
I defined an helper:
I defined a server searchSource:
And i am calling the search in the helper at the keyup as in you example:
But i cannot get the metadata. In the browser console i get an empty metadata object. If i uncomment the getMetadata() call in the searchSource server side definition I get a getMetadata is not defined.
Could you help me understand where is the error?
Thank you for your great job!
The text was updated successfully, but these errors were encountered: