InstantSearch.js 自定义小部件增加返回结果

问题描述

正如您在下面的代码中看到的,我制作了 2 个自定义小部件,一个用于搜索一个用于显示结果,但我无法增加返回结果的限制。当页面加载时,它会自动发出请求并检索认结果,无需查询

我们有超过 500 多个结果,所有结果都必须显示在 UI 上,我无法在任何地方修改结果的限制。限制始终为 200。作为后端,我没有使用 algolia 而是使用 meilisearch,但这不会以任何方式影响这一点。

正如您在图片中看到的,searchParamters 被修改并设置为限制为 1000,但是当发出请求时,它发送为 200。

enter image description here

enter image description here

       const search = instantsearch({
            indexName: "store",searchClient: instantMeiliSearch(m_host,m_key),});

       search.addWidgets([
        configure({
            hitsPerPage: 1000,limit: 1000,filters: `image!=null AND is_active=1 AND (countries_ids=${country_id} OR countries_ids=0) AND goto_link != null`,attributesToHighlight: [],paginationLimitedTo: 1000,}),{
            init: function (opts) {
                const helper = opts.helper;

                const input = document.querySelector('#searchBox');
                input.addEventListener('input',function (e) {
                    helper.setQuery(e.currentTarget.value) // update the parameters
                        .search(); // launch the query
                });
            }
        },{
            render: function (opts) {
                let results = opts.results;
                // read the hits from the results and transform them into HTML.
                let res = toArray(groupBy(filter_stores(results.hits),'category_id'));
                $(`.stores-list`).empty()
                $(`.categories-list`).hide()
                res = res.map(it => {
                    let copy = it;
                    copy[1] = _.orderBy(it[1].map(store => {
                        store.default_rank = store.hasOwnProperty(`rank_country_${country_id}`) ? store[`rank_country_${country_id}`] : store.default_rank;
                        return store;
                    }),'default_rank','asc');
                    return copy;
                });
                res.map(pairs => {
                    let [category_id,stores] = pairs;
                    $(`#category_${category_id}`).show()
                    let html = stores.map(h => create_store(h)).join('')
                    $(`#store_list_${category_id}`).html(html)
                });
            },}
    ]);

    search.start();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...