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

Allow search from custom function #2655

Closed
MrMooky opened this issue Jan 12, 2018 · 2 comments
Closed

Allow search from custom function #2655

MrMooky opened this issue Jan 12, 2018 · 2 comments

Comments

@MrMooky
Copy link

MrMooky commented Jan 12, 2018

This is not a bug, but rather a feature request of some sorts.

I'd like to see the possibility to manually trigger a search from a custom function. So let's say you have your regular index with categories. Now, it would be neat to have a custom function (not attached to instantsearch) to call a category from a custom function.

Simply put, something that works like this:

<a href="javascript:;" data-category="catname" class="link">Test-Link</a>

$(".link").on("click", function(){
    var targetCategory = $(this).data("category");
    // search current index from targetCategory
})

For some projects, we don't need a list of categories but rather single links. This would come handy. Or, if that kind of function is not possible, at least have the possibility to fill the search input with the value and trigger a search.

@samouss
Copy link
Contributor

samouss commented Jan 12, 2018

You have different API available to achieve such behaviour:

  • You can use the connectors to implement your own widget. You will have the full control of what is render without the need to reimplement all the logic of the widgets. But you are still tight to InstantSearch.

  • You can also create a full custom widget, you will have access to helper instance. The helper is the internal tool that we used to track the state of the search. Again you are still tight to InstantSearch.

  • Last option you can also get the helper reference from the InstantSearch instance if you don't want to be tight to it. You can retrieve the helper instance like this:

const search = instantseach(...);

search.start();

search.helper // You can do whatever you want with it

@MrMooky
Copy link
Author

MrMooky commented Jan 12, 2018

The last option would work, I guess. Got me into the right direction... haven't done much with the helper yet but seems to be what I'm looking for. Thanks.

@MrMooky MrMooky closed this as completed Jan 12, 2018
Haroenv pushed a commit that referenced this issue Jan 4, 2023
# [6.0.0-beta.1](algolia/react-instantsearch@v5.7.0...v6.0.0-beta.1) (2019-10-18)

### Bug Fixes

* **connectToggleRefinement:** cast currentRefinement to boolean ([algolia/react-instantsearch#2701](algolia/react-instantsearch#2701)) ([aaf8043](algolia/react-instantsearch@aaf8043))
* **deps:** update dependency antd to v3.19.3 ([algolia/react-instantsearch#2530](algolia/react-instantsearch#2530)) ([a2a9ba0](algolia/react-instantsearch@a2a9ba0))
* **deps:** update dependency antd to v3.19.4 ([algolia/react-instantsearch#2559](algolia/react-instantsearch#2559)) ([c0d13a5](algolia/react-instantsearch@c0d13a5))
* **deps:** update dependency antd to v3.19.5 ([algolia/react-instantsearch#2560](algolia/react-instantsearch#2560)) ([089ed3e](algolia/react-instantsearch@089ed3e))
* **deps:** update dependency antd to v3.19.6 ([algolia/react-instantsearch#2564](algolia/react-instantsearch#2564)) ([eb496fb](algolia/react-instantsearch@eb496fb))
* **deps:** update dependency antd to v3.19.7 ([algolia/react-instantsearch#2573](algolia/react-instantsearch#2573)) ([f76c9b9](algolia/react-instantsearch@f76c9b9))
* **deps:** update dependency antd to v3.19.8 ([algolia/react-instantsearch#2584](algolia/react-instantsearch#2584)) ([2d243cd](algolia/react-instantsearch@2d243cd))
* **deps:** update dependency antd to v3.20.0 ([algolia/react-instantsearch#2611](algolia/react-instantsearch#2611)) ([635c0ee](algolia/react-instantsearch@635c0ee))
* **deps:** update dependency antd to v3.20.1 ([algolia/react-instantsearch#2635](algolia/react-instantsearch#2635)) ([c45ad1a](algolia/react-instantsearch@c45ad1a))
* **deps:** update dependency antd to v3.20.2 ([algolia/react-instantsearch#2655](algolia/react-instantsearch#2655)) ([aff6af1](algolia/react-instantsearch@aff6af1))
* **deps:** update dependency antd to v3.20.3 ([algolia/react-instantsearch#2658](algolia/react-instantsearch#2658)) ([2fe1b08](algolia/react-instantsearch@2fe1b08))
* **deps:** update dependency antd to v3.20.5 ([algolia/react-instantsearch#2686](algolia/react-instantsearch#2686)) ([767f6bb](algolia/react-instantsearch@767f6bb))
* **deps:** update dependency antd to v3.20.6 ([algolia/react-instantsearch#2711](algolia/react-instantsearch#2711)) ([1026bb1](algolia/react-instantsearch@1026bb1))
* **deps:** update dependency antd to v3.20.7 ([algolia/react-instantsearch#2712](algolia/react-instantsearch#2712)) ([5dbe0f6](algolia/react-instantsearch@5dbe0f6))
* **deps:** update dependency antd to v3.21.1 ([algolia/react-instantsearch#2736](algolia/react-instantsearch#2736)) ([b6028e7](algolia/react-instantsearch@b6028e7))
* **deps:** update dependency antd to v3.21.2 ([algolia/react-instantsearch#2738](algolia/react-instantsearch#2738)) ([fab0a42](algolia/react-instantsearch@fab0a42))
* **deps:** update dependency antd to v3.21.4 ([algolia/react-instantsearch#2747](algolia/react-instantsearch#2747)) ([b31b543](algolia/react-instantsearch@b31b543))
* **deps:** update dependency antd to v3.22.0 ([algolia/react-instantsearch#2758](algolia/react-instantsearch#2758)) ([be351e1](algolia/react-instantsearch@be351e1))
* **deps:** update dependency antd to v3.22.2 ([algolia/react-instantsearch#2791](algolia/react-instantsearch#2791)) ([79ef129](algolia/react-instantsearch@79ef129))
* **deps:** update dependency antd to v3.23.2 ([algolia/react-instantsearch#2814](algolia/react-instantsearch#2814)) ([bd12e7a](algolia/react-instantsearch@bd12e7a))
* **deps:** update dependency lodash to v4.17.13 ([2d2d2da](algolia/react-instantsearch@2d2d2da))
* **deps:** update dependency lodash to v4.17.14 ([algolia/react-instantsearch#2647](algolia/react-instantsearch#2647)) ([3075507](algolia/react-instantsearch@3075507))
* **deps:** update dependency lodash to v4.17.15 ([algolia/react-instantsearch#2684](algolia/react-instantsearch#2684)) ([081fe68](algolia/react-instantsearch@081fe68))
* **deps:** update dependency next to v9 ([algolia/react-instantsearch#2638](algolia/react-instantsearch#2638)) ([23be0c2](algolia/react-instantsearch@23be0c2))
* **deps:** update dependency next to v9.0.1 ([algolia/react-instantsearch#2652](algolia/react-instantsearch#2652)) ([100f04a](algolia/react-instantsearch@100f04a))
* **deps:** update dependency next to v9.0.2 ([algolia/react-instantsearch#2662](algolia/react-instantsearch#2662)) ([09947fb](algolia/react-instantsearch@09947fb))
* **deps:** update dependency next to v9.0.3 ([algolia/react-instantsearch#2724](algolia/react-instantsearch#2724)) ([aaa3f4c](algolia/react-instantsearch@aaa3f4c))
* **deps:** update dependency next to v9.0.4 ([algolia/react-instantsearch#2767](algolia/react-instantsearch#2767)) ([2a73410](algolia/react-instantsearch@2a73410))
* **deps:** update dependency next to v9.0.5 ([algolia/react-instantsearch#2789](algolia/react-instantsearch#2789)) ([c3ef3a7](algolia/react-instantsearch@c3ef3a7))
* **deps:** update dependency qs to v6.8.0 ([algolia/react-instantsearch#2757](algolia/react-instantsearch#2757)) ([0eb150a](algolia/react-instantsearch@0eb150a))
* **deps:** update dependency react-compound-slider to v2.1.0 ([algolia/react-instantsearch#2610](algolia/react-instantsearch#2610)) ([00c680d](algolia/react-instantsearch@00c680d))
* **deps:** update dependency react-compound-slider to v2.2.0 ([algolia/react-instantsearch#2649](algolia/react-instantsearch#2649)) ([fb37e13](algolia/react-instantsearch@fb37e13))
* **deps:** update dependency react-native-vector-icons to v6.5.0 ([algolia/react-instantsearch#2520](algolia/react-instantsearch#2520)) ([2da40fa](algolia/react-instantsearch@2da40fa))
* **deps:** update dependency react-native-vector-icons to v6.6.0 ([algolia/react-instantsearch#2599](algolia/react-instantsearch#2599)) ([cc3a5df](algolia/react-instantsearch@cc3a5df))
* **deps:** update dependency react-router-dom to v5.0.1 ([algolia/react-instantsearch#2506](algolia/react-instantsearch#2506)) ([10c1a8e](algolia/react-instantsearch@10c1a8e))
* **highlight:** switch to index as key ([algolia/react-instantsearch#2691](algolia/react-instantsearch#2691)) ([78e6fad](algolia/react-instantsearch@78e6fad)), closes [#2688](algolia/react-instantsearch#2688)
* **voiceSearch:** fix incorrect status on stop ([algolia/react-instantsearch#2535](algolia/react-instantsearch#2535)) ([129596e](algolia/react-instantsearch@129596e))

### chore

* **release:** 6.0.0-beta.1 ([algolia/react-instantsearch#2861](algolia/react-instantsearch#2861)) ([9a329da](algolia/react-instantsearch@9a329da)), closes [#2023](algolia/react-instantsearch#2023) [#2178](algolia/react-instantsearch#2178) [#2178](algolia/react-instantsearch#2178) [#2179](algolia/react-instantsearch#2179) [#2180](algolia/react-instantsearch#2180) [#2181](algolia/react-instantsearch#2181) [#2185](algolia/react-instantsearch#2185) [#2192](algolia/react-instantsearch#2192) [#2189](algolia/react-instantsearch#2189) [#2190](algolia/react-instantsearch#2190) [#2179](algolia/react-instantsearch#2179) [#2178](algolia/react-instantsearch#2178) [#2180](algolia/react-instantsearch#2180) [#2181](algolia/react-instantsearch#2181) [#2185](algolia/react-instantsearch#2185) [#2192](algolia/react-instantsearch#2192) [#2190](algolia/react-instantsearch#2190) [#2203](algolia/react-instantsearch#2203) [#2432](algolia/react-instantsearch#2432) [#2444](algolia/react-instantsearch#2444) [#2357](algolia/react-instantsearch#2357) [#2454](algolia/react-instantsearch#2454) [#2455](algolia/react-instantsearch#2455) [#2459](algolia/react-instantsearch#2459) [#2458](algolia/react-instantsearch#2458) [#2460](algolia/react-instantsearch#2460) [#2442](algolia/react-instantsearch#2442) [#2446](algolia/react-instantsearch#2446) [#2434](algolia/react-instantsearch#2434) [#2467](algolia/react-instantsearch#2467) [#2466](algolia/react-instantsearch#2466) [#2288](algolia/react-instantsearch#2288) [#2290](algolia/react-instantsearch#2290) [#2289](algolia/react-instantsearch#2289) [#2305](algolia/react-instantsearch#2305) [#2338](algolia/react-instantsearch#2338) [#2461](algolia/react-instantsearch#2461) [#2442](algolia/react-instantsearch#2442) [#2307](algolia/react-instantsearch#2307) [#2314](algolia/react-instantsearch#2314) [#2304](algolia/react-instantsearch#2304) [#2379](algolia/react-instantsearch#2379) [#2552](algolia/react-instantsearch#2552) [#2555](algolia/react-instantsearch#2555) [#2536](algolia/react-instantsearch#2536) [#2537](algolia/react-instantsearch#2537) [#2339](algolia/react-instantsearch#2339) [#2349](algolia/react-instantsearch#2349) [#2570](algolia/react-instantsearch#2570) [#2462](algolia/react-instantsearch#2462) [#2600](algolia/react-instantsearch#2600) [#2468](algolia/react-instantsearch#2468) [#2626](algolia/react-instantsearch#2626) [#2621](algolia/react-instantsearch#2621) [#2627](algolia/react-instantsearch#2627) [#2644](algolia/react-instantsearch#2644) [#2626](algolia/react-instantsearch#2626) [#2645](algolia/react-instantsearch#2645) [#2339](algolia/react-instantsearch#2339) [#2643](algolia/react-instantsearch#2643) [#2467](algolia/react-instantsearch#2467) [#2690](algolia/react-instantsearch#2690) [#2687](algolia/react-instantsearch#2687) [#2722](algolia/react-instantsearch#2722) [#2568](algolia/react-instantsearch#2568) [#2726](algolia/react-instantsearch#2726) [#2379](algolia/react-instantsearch#2379) [#2289](algolia/react-instantsearch#2289) [#2290](algolia/react-instantsearch#2290) [#2304](algolia/react-instantsearch#2304) [#2307](algolia/react-instantsearch#2307) [#2314](algolia/react-instantsearch#2314) [#2288](algolia/react-instantsearch#2288) [#2305](algolia/react-instantsearch#2305) [#2701](algolia/react-instantsearch#2701) [#2568](algolia/react-instantsearch#2568) [#2357](algolia/react-instantsearch#2357) [#2552](algolia/react-instantsearch#2552) [#2530](algolia/react-instantsearch#2530) [#2559](algolia/react-instantsearch#2559) [#2560](algolia/react-instantsearch#2560) [#2564](algolia/react-instantsearch#2564) [#2573](algolia/react-instantsearch#2573) [#2584](algolia/react-instantsearch#2584) [#2611](algolia/react-instantsearch#2611) [#2635](algolia/react-instantsearch#2635) [#2655](algolia/react-instantsearch#2655) [#2658](algolia/react-instantsearch#2658) [#2686](algolia/react-instantsearch#2686) [#2711](algolia/react-instantsearch#2711) [#2712](algolia/react-instantsearch#2712) [#2736](algolia/react-instantsearch#2736) [#2738](algolia/react-instantsearch#2738) [#2747](algolia/react-instantsearch#2747) [#2758](algolia/react-instantsearch#2758) [#2647](algolia/react-instantsearch#2647) [#2684](algolia/react-instantsearch#2684) [#2638](algolia/react-instantsearch#2638) [#2652](algolia/react-instantsearch#2652) [#2662](algolia/react-instantsearch#2662) [#2724](algolia/react-instantsearch#2724) [#2767](algolia/react-instantsearch#2767) [#2757](algolia/react-instantsearch#2757) [#2610](algolia/react-instantsearch#2610) [#2649](algolia/react-instantsearch#2649) [#2520](algolia/react-instantsearch#2520) [#2599](algolia/react-instantsearch#2599) [#2506](algolia/react-instantsearch#2506) [#2467](algolia/react-instantsearch#2467) [#2626](algolia/react-instantsearch#2626) [#2690](algolia/react-instantsearch#2690) [#2688](algolia/react-instantsearch#2688) [#2626](algolia/react-instantsearch#2626) [#2726](algolia/react-instantsearch#2726) [#2535](algolia/react-instantsearch#2535) [#2461](algolia/react-instantsearch#2461) [#2434](algolia/react-instantsearch#2434) [#2687](algolia/react-instantsearch#2687) [#2338](algolia/react-instantsearch#2338) [#2179](algolia/react-instantsearch#2179) [#2180](algolia/react-instantsearch#2180) [#2181](algolia/react-instantsearch#2181) [#2185](algolia/react-instantsearch#2185) [#2192](algolia/react-instantsearch#2192) [#2189](algolia/react-instantsearch#2189) [#2190](algolia/react-instantsearch#2190) [#2179](algolia/react-instantsearch#2179) [#2180](algolia/react-instantsearch#2180) [#2181](algolia/react-instantsearch#2181) [#2185](algolia/react-instantsearch#2185) [#2192](algolia/react-instantsearch#2192) [#2190](algolia/react-instantsearch#2190) [#2536](algolia/react-instantsearch#2536) [#2537](algolia/react-instantsearch#2537) [#2834](algolia/react-instantsearch#2834) [#2845](algolia/react-instantsearch#2845) [#2842](algolia/react-instantsearch#2842) [#2852](algolia/react-instantsearch#2852) [#2853](algolia/react-instantsearch#2853)

### BREAKING CHANGES

* **release:** translation will render default value if passed undefined as value

* chore(lodash): remove imports

* fix(translation): allow undefined value to be passed on purpose
* **release:** no longer do we allow paths like `attribute[5].something`, or other indexed forms, only `.` is allowed as special key.

All existing tests still pass, and we never documented you could use `lodash.get` patterns other than `.`.

* feat(get): accept array & bracked-separated string

moved to utils at the same time

* fix typo

* feedback: test for undefined behaviour

* chore(size): update expectation

this will go down afterwards, but for now there's some more duplication
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

2 participants