Closed meecect closed 2 years ago
Could you provide me with additional information of your code? There's different ways of going about it.
Sorry it took so long to get back to you. Let's say I have a collection of userprofiles. I create an index of these to use with easy-search. It works fine.
I have a site level search component that searches userprofiles, using the out-of-the-box components. As I type, it starts showing me matches. The number of matches returned corresponds to what I have entered in the index config, so let's say it's 10. This limit is set on the index, not on the component.
I then had another part of the site where there are groups and members (members are userprofiles). I built a small interface to make it easy for admins to add members to their group. The interface is another ootb easy-search component to search for members to add.
As the user types a username, easy-search returns the matches, but I realized that returning 10 results here made my interface a little clunky, and I preferred to return just the top 3.
That is when I realized that there was no way to customize (I assume) the limit on a search component basis, only at the index level (as far as i know).
I thought I would have lots of different UI cases where I want to search through a given index and have the results tweaked based on the user interface component and application requirements, but that seems to mean that I may need to build a unique index for each use case.
Is that right? Or is there a way to customize the OOTB components to do simple things like limiting the results? Or should I just build my own components and do it in helpers and such? I am trying to avoid having one collection and then 6 different indexes on it with just slightly different configs.
I have successfully used the getComponentMethods function to override the query for setting things like facets, but I was unsure if I can use the same method to change the number of results returned or if that would screw up the search collection.
(I know this isn't literal code, but I can supply some if needed)
With component methods you can have a customization that isn't possible with the default components, please check them out and mix and match to your needs: http://matteodem.github.io/meteor-easy-search/docs/components/
I have one index with a defaultSearchOptions: { limit: 10 } set.
Can I increase or decrease the limit on a component basis? I have multiple search boxes using the index and sometimes want to display less results (or more) than the default.
If I can't do it as a configuration of the component, can I do it in my helper function that returns the index?
Or do I need to change the templates subscription function?
thanks,