Skip to content
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

Auto-suggest does not work with selectors #417

Closed
holwech opened this issue Jan 6, 2016 · 3 comments
Closed

Auto-suggest does not work with selectors #417

holwech opened this issue Jan 6, 2016 · 3 comments

Comments

@holwech
Copy link

holwech commented Jan 6, 2016

I could be missing something, but this works perfectly when using the normal input component. It also works without any selectors, but with a selector no suggestions appear at all.

client

Template.tools.helpers({
    commentsIndex: function() {
        return CommentsIndex;
    }
});
<template name='tools'>
    <div class='row'>
        <div class="autosuggest-component">
            {{> EasySearch.Autosuggest index=commentsIndex}}
        </div>
    </div>
</template>

Setting the selector-value

setSearchLanguage = function(lang) {
    CommentsIndex.getComponentMethods()
        .addProps('language', lang);
}

server

CommentsIndex = new EasySearch.Index({
    collection: Comments,
    fields: ['comment'],
    engine: new EasySearch.MongoDB({
        selector: function (searchObject, options, aggregation) {
            let selector = this.defaultConfiguration().selector(searchObject, options, aggregation);
            selector.language = options.search.props.language;
            return selector;
        }
    })
});
@holwech holwech changed the title Auto suggest does not work with selectors Auto-suggest does not work with selectors Jan 6, 2016
@matteodem
Copy link
Owner

This has to do with the autosuggest component not using the component methods. I'll have a look at this soonish

@Tzikas
Copy link

Tzikas commented Aug 3, 2016

+1 Same issue. Thank you.

@matteodem
Copy link
Owner

This is fixed in the latest version 2.1.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants