-
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
Searching for other value types than strings #43
Comments
I've just made a custom version for myself that accepts an object. Besides adding "Object" to the check function arguments in the search.source Meteor call, I had to make several surgical changes to the client code to get it all to work. For instance:
Separate but related to those modifications was an issue of duplicate Mongo-selector-building code on the server and client. Let me see if I can explain. The existing SearchSource code requires the user to define her own server-side Mongo selector but, oddly, I thought, it builds the client-side selector (an $or) in its own code (see getData in client.js). Having added an optional callback for the client selector (see item 3, above), I tried get SearchSource itself to share a Mongo-selector-building function between the client and server. After some struggle and breakpointing I was enlightened to the fact that there's no simple way to pass a function between client and server via, say, the existing SearchSource ‘option’ argument. So, I decided to share a mongo-selector-building function externally from SearchSource: a shared function available to the client and server callbacks. Less modular but fine for now. It works well. At present, I have as search criteria only a date range and a string, but there’s no limit on the complexity of search allowed by this architecture. That’s satisfying. I hope this little note encourages you. |
Thanks a lot for these insights! |
First of all: I really like this package, it helps a lot to implement search functionality.
Today, I tried to set-up a search that uses an array of strings instead of a plain string as an input parameter. This did not work. Instead, I got the following error message:
Is there any particular reason why the input parameter is limited to a string? I will now concat the array using a delimiter character as a work-around, but it would be nicer if I could send arrays or plain objects directly.
The text was updated successfully, but these errors were encountered: