-
Notifications
You must be signed in to change notification settings - Fork 35
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
Design keyword based search for frontpage #684
Comments
@frenchbread Since you were interested in the implementation task, could you take the design as well? Refer to #629 for original idea. |
There are going to be two scenarios how to make a search for API Backends: One of the approaches is to follow this guide provided in the README and use separate mongodb instance rather than build in meteor mongo. As mentioned in repo above:
Second is to build own method with a complex query: return ApiBackends.find(<query_object>); In example provided return ApiBackends.find({ "name": /maps/ });
// Returns an array ob objects with a name that contains "maps" word in it Example above is case sensitive though, for that reason could use extended approach, e.g.: return ApiBackends.find({ "name": /^maps$/i }); Or using RegEx by providing an object with a return ApiBackends.find({ "name": { $regex : '^maps$' } }); // case INSENSITIVE |
One useful feature:Once search is submitted, and if the search query 100% matches the apiBackend (or only one document was returned), we can redirect user directly to that |
Mongo query example that I came up with: // Construct query
var query = {
$or: [
{
name: {
$regex: searchPhrase,
$options: 'i'
}
},
{
backend_host: {
$regex: searchPhrase,
$options: 'i'
}
}
]
};
// Fetch apiBackends
var foundApiBackends = ApiBackends.find(query).fetch(); This example represents a search for
Related commit - |
Search functionality is implemented and works nicely.Even though documents are returned, getting this error:
I've been trying to fix it by adding @brylie Any thoughts? |
@frenchbread it looks like you return an empty object if there is not a search term, which is not a cursor. Check out the Guide to Full Text Search in Meteor for a working implementation. Make sure you are also indexing the fields for searching, using |
@brylie Thanks! That helped to fix the issue. |
PR #719 created. Currently having I'm going to improve the visual design of search result returned on a search page with @elnzv's help. |
Removed @apinf/developers please review. |
Feature/search apis - closes #684
Related to issue #629.
Definition of done
Frontpage
title
field.backend_host
field. - ?Results page
Search results
The text was updated successfully, but these errors were encountered: