reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

ReactiveComponent type

Open jorgeju4rez opened this issue 2 years ago • 2 comments

Affected Projects React

Library Version: x.y.z 4.0.0-rc.10

Describe the bug The React Component returns the empty value matches with the default value of type: "term", if I change it to "search" by postman it returns the expected result. Is there a way to change this?

To Reproduce

POST  http://localhost:8000/catalogodev/_reactivesearch
{
  "settings": {
    "recordAnalytics": true,
    "enableQueryRules": true,
    "emptyQuery": true,
    "suggestionAnalytics": true
  },
  "query": [
    {
      "id": "products",
      "type": "term",
      "dataField": [
        "reactive_component_field"
      ],
      "execute": true,
      "react": {
        "and": "products__internal"
      },
      "defaultQuery": {
        "query": {
          # query
    }
  ]
}

Expected behavior

{
  "settings": {
    "recordAnalytics": true,
    "enableQueryRules": true,
    "emptyQuery": true,
    "suggestionAnalytics": true
  },
  "query": [
    {
      "id": "products",
      "type": "search",
      "dataField": [
        "reactive_component_field"
      ],
      "execute": true,
      "react": {
        "and": "products__internal"
      },
      "defaultQuery": {
          # query
    }
  ]
}

jorgeju4rez avatar Apr 26 '23 11:04 jorgeju4rez

What Reactivesearch component are you using?

SavvyShah avatar Jun 27 '23 18:06 SavvyShah

@jorgeju4rez I see you are using ReactiveComponent, The ReactiveComponent is designed with a predefined query type - 'term' and doesn't have the option to change it.

However, the query manipulation might be possible using the transformRequest prop in the ReactiveBase wrapper component.

Refer here -> https://docs.reactivesearch.io/docs/reactivesearch/react/v3/overview/reactivebase/#transformrequest

mohdashraf010897 avatar Jun 28 '23 05:06 mohdashraf010897