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

[Feature] Support full text search for MultiChoice and auto complete input #10525

Closed
mukeshkdangi opened this issue Sep 24, 2020 · 7 comments · Fixed by #11605
Closed

[Feature] Support full text search for MultiChoice and auto complete input #10525

mukeshkdangi opened this issue Sep 24, 2020 · 7 comments · Fixed by #11605

Comments

@mukeshkdangi
Copy link

mukeshkdangi commented Sep 24, 2020

Bokeh 2.1.1, Python 3, Windows 10, Chrome

Description of expected behavior and the observed behavior

1. Bokeh Multichoice search is not working as expected. When type a string suggestion list in dropdown is not showing correct results
For example Dropdown list has around 7 elements containing 'ca' as a substring but when i type 'ca' only 4 elements shows up in the drop down instead of 7.
Bokeh_drop_down_search_error_1
Bokeh_drop_down_search_error_2

2. Bokeh auto complete is not showing results for sub string. It only shows when we type string from start. I tried using modified version of bokeh-widget-2.2.1.js but for some reason bokeh is still able acess bokeh-widget.min.js

2.1. Sub String search is not working which very essential thing when we talk about search.
2,2 I added bokeh-widgets-2.1.1.js JS file in my code as :

 <script src="/bokeh_app/static/js/jquery.min.js"></script>
    **<script src="/bokeh_app/static/js/bokeh-widgets-2.1.1.js"></script>**
    <script src="/bokeh_app/static/js/jquery-ui.min.js"></script>
<script src="/bokeh_app/static/js/bokeh-2.1.1.js"></script>
<script src="/bokeh_app/static/js/bokeh-api.min.js"></script>
<script src="/bokeh_app/static/js/bokeh-gl.min.js"></script>
<script src="/bokeh_app/static/js/bokeh-tables.min.js"></script>

However Bokeh is accessing bokeh-widgets.min.js instead of modified **<script src="/bokeh_app/static/js/bokeh-widgets-2.1.1.js"></script>** which is not there in my project structure at all.
Bokeh_minJS_error

Any help regarding these two issues is very critical and appreciated

@bryevdv
Copy link
Member

bryevdv commented Sep 24, 2020

The MulitChoice is a wrapper around choices.js: https://github.com/jshjohnson/Choices

Whether or not we can support full-text support is entirely dependent on what choices.js can support. If choices.js does not support full-text search then there is not much we can do except wait and try to advocate for that feature upstream. Some investigation will be needed, or if you know already please respond with details.

For the questions about developing BokehJS/building a custom BokehJS that is outside the scope of the issue tracker. The Dev Guide is here:

https://docs.bokeh.org/en/latest/docs/dev_guide.html

and the community support Discourse is here:

https://discourse.bokeh.org

@bryevdv bryevdv changed the title [BUG] Bokeh MultiChoice search and Autocomplete Input search is not working [Feature] Support full text search for MultiChoice Sep 24, 2020
@mukeshkdangi
Copy link
Author

thanks for the update.
can we do something in bokeh-widget.js for full text search. The auto complete class has a function which has 'search_string.startswith(sub_string).' can we just try replacing that with 'includes()' API of JS. i was trying to do same but bokeh is by default using bokeh-widget.min.js instead of user included js.

for (const text of this.model.completions) {
                        if (acnorm(text).includes(acnorm(value))) {
                            completions.push(text);
                        }
                    }

also i believe this Multichoice search is bug instead of a new feature.

Thanks

@bryevdv
Copy link
Member

bryevdv commented Sep 24, 2020

also i believe this Multichoice search is bug instead of a new feature.

Noted, but disagree.

can we do something in bokeh-widget.js for full text search.

As I mentioned, the place to ask "how do I" support questions is the Discourse, not the issue tracker.

@mukeshkdangi mukeshkdangi changed the title [Feature] Support full text search for MultiChoice [Feature] Support full text search for MultiChoice and auto complete input Sep 24, 2020
@mukeshkdangi
Copy link
Author

adding 'includes' worked for in case if AutoCompleteInout so it's better to add if (acnorm(text).includes(acnorm(value))) this line of code instead of startsWith() . I can not contribute because JS file is not available for contribution.

Regarding ChoicesJS, wouldn't it be a simple HTML5 dropdown thing instead of relying on someone else's library which has issues.

@bryevdv
Copy link
Member

bryevdv commented Oct 23, 2020

wouldn't it be a simple HTML5 dropdown thing instead of relying on someone else's library which has issues.

@mukeshkdangi The MultiChoice widget was added specifically because users loudly asked for a "modern" choice widget. If you don't like it, nothing and no-one is forcing you to use it. If you want a simple basic HTML dropdown, that is what the Select

https://docs.bokeh.org/en/latest/docs/user_guide/interaction/widgets.html#select

but note that it also only currently has "startswith" search capability.

I can not contribute because JS file is not available for contribution.

I don't know what this means. If there is a change in BokehJS you think would improve things then you can fork this repository and submit the change as a pull request.

@rsdenijs
Copy link

rsdenijs commented Mar 26, 2021

I think the issue 1. that is listed in here is simply that choices.js only shows 4 results by default, it is listed in their readme ( searchResultLimit: 4,). This is an option MultiChoice does not expose atm.

@philippjfr
Copy link
Contributor

It would be quite straightforward to expose the searchResultLimit option on the MultiChoice widget (with a better name).

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

Successfully merging a pull request may close this issue.

5 participants