appbaseio / reactivesearch

Search UI components for React and Vue
https://opensource.appbase.io/reactivesearch
Apache License 2.0
4.89k stars 471 forks source link

Unable to use multi-select and its giving error #2247

Open deepak-sisodiya opened 9 months ago

deepak-sisodiya commented 9 months ago

Affected Projects Vue.JS

Library Version: x.y.z "@appbaseio/reactivesearch-vue": "3.1.0-alpha.1",

Describe the bug I am migrating our app from vue 2 to vue 3, so also need to migrate appbase. there is is migration docs which we following. everything seems work but when we filter it gives this error

bugsnag.js:2688 {"settings":{"took":6,"searchTook":2},"SearchResults":{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [email] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"4760d3c8-ab04-450d-b83c-83ff9bdc1d0d","node":"Fa2quZrSSlCuIwgA2TZRVg","reason":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [email] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [email] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [email] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400}}
console.<computed> @ bugsnag.js:2688
handleError @ utils.js:1
eval @ query.js:1
Screenshot 2023-09-13 at 3 02 53 PM

Desktop (please complete the following information):


Parent component

deepak-sisodiya commented 9 months ago

on searching also, I am getting same error

<search-box
    placeholder="Search Registrants..."
    className="appbase-search"
    :innerClass="{
      list: 'search-bar-list'
    }"
    queryFormat="and"
    filterLabel="Search"
    componentId="SearchUsers"
    :dataField="['full_name']"
  />
SavvyShah commented 9 months ago

It seems something is wrong with dataField type in MultiList. Use role.keyword instead of role and see if the error goes away. Also you should use search-box instead of data-search in v3. Refer migration guide for other changes.

Also can you check by removing sortOptions key passed to ReactiveList, so we can just know the root cause if above doesn't work.

siddharthlatest commented 9 months ago

@deepak-sisodiya Based on the error message, the references for the use of the email field for either sorting or aggregations on the searchResults componentId. The code snippet you've shared looks fine to me, as I see that you're using email.keyword there. Perhaps narrow it down further based on the error message you see. You can try removing the component in question or sortOptions values to see if they help.

And for the searching use-case error, can you share the exact error message?

deepak-sisodiya commented 9 months ago

@SavvyShah @siddharthlatest Thanks for the reply. I switched to other things in between. today I checked it.

Here is the update.

  1. I removed sortOptions from ReactiveList , searching and filter for each column starts working now.
  2. I replaced the data-search with search-box, missed it while doing migration.

New issues

  1. we do not have sorting UI now. If we have sortOptions again, other things do not work.
  2. following code is not working for refresh list - this issues is not due to removing sortOptions,
refreshList: throttle(function () {
      const datalist = this.$refs.datalist;

      if (datalist) {
        this.setLoadingRegistration(true);
        if (!this.columns?.length) {
          this.fetchColumns();
        }
        const currentPage = datalist.$el.__vue__.currentPageState;
        datalist.$el.__vue__.setPage(currentPage + 1);

        setTimeout(() => {
          datalist.$el.__vue__.setPage(currentPage);
          this.setLoadingRegistration(false);
        }, 100);
      } else {
        LogRocket.info('Could not refresh by page change because reactivebase was not found!');
      }
    }, 2000),

error is - Cannot read properties of undefined (reading 'currentPageState').

Please help @SavvyShah @siddharthlatest

siddharthlatest commented 9 months ago

@deepak-sisodiya Thanks for the update, glad to see that you got the search UI working.

On the new issues, would you be able to reproduce these two issues with one of our public demos?

deepak-sisodiya commented 9 months ago

@siddharthlatest where is public demo link?

deepak-sisodiya commented 9 months ago

@siddharthlatest @SavvyShah I have refresh button outside of table, how can I set the setPage, is there any way for it.

deepak-sisodiya commented 9 months ago

on refresh, I want to set page to 1

siddharthlatest commented 9 months ago

@deepak-sisodiya For the public demo, you can use this: https://codesandbox.io/s/github/appbaseio/vue-quick-start/tree/step-5/?from-embed (It has searchbox and reactive list). See if you can reproduce the issue by including sort options and the page operation

deepak-sisodiya commented 9 months ago

@siddharthlatest

  1. we do not have sorting UI now. If we have sortOptions again, other things do not work. this is fixed by removing dataField and passing sortOptions

  2. following code is not working for refresh list I changed the logic for it, seems working

thanks