tmcgee / cmv-widgets

Widgets for CMV, the Configurable Map Viewer.
https://cmv.io/
MIT License
38 stars 48 forks source link

Search Query Configuration #93

Closed cmccullough2 closed 7 years ago

cmccullough2 commented 7 years ago

I have a query that searches through >42000 rows of data. How can I set up a wild card in the expression so that when a user starts typing the results are filtered to find the right field this would work like auto complete.
EX: name: 'Search Airport by Name', searchFields: [ { name: 'Name', label: 'Name', expression: '(Name LIKE \'%[value]%\')', //unique: true required: true, minChars: 3

tmcgee commented 7 years ago

Are you asking for type-ahead functionality like you get when you do a search with the Esri search widget (aka geocoder widget)? You might be able to do that with the Esri search widget if you turn on type-ahead for your Service though I suspect it would be very slow with 42,000 features in a MapService/FeatureService layer. You might want to consider a geocoding service to speed up the lookups/type-ahead.

Type-ahead is something I have considered adding to the search widget but not sure it would be usable with 42,000 rows for the same limitations.

cmccullough2 commented 7 years ago

Yes. I have been trying to figure out how to render this data in a faster manner. We like all the other capabilities in the widget for our search. I really like your widget. Unfortunately, this capability is one of my most popular widgets in Flex. I need to figure the mystery out. Thanks

tmcgee commented 7 years ago

So type-ahead works well with the Flex widget? Then we can definitely make it work better within a JavaScript-based widget. 😄

cmccullough2 commented 7 years ago

:). It is using the eSearch widget. I get about 500 hits per day on this widget. My team also needs to work on faster data rendering options.

cmccullough2 commented 7 years ago

This widget 'almost' does what I need it to do. The results do not display in the attribute table. It also displays this error that I want to eliminate, Unable to get property 'toLowerCase' of undefined or null reference. This is why I need to migrate to your search widget. https://geonet.esri.com/docs/DOC-6889

tmcgee commented 7 years ago

Your link is for the eBookmarks widget but I think you are referring to the JavaScript WAB version of the eSearch widget. That widget doesn't work with my AttributesTable widget. The widget makes assumptions that the WAB AtttributesTable widget is being used. I know other devs had modified an older version of the eSearch widget to pass the results to my AttributesTable widget though I don't know the full effort involved.

Is the type-ahead the only issue holding you back from using my Search widget? I looked the other day for a type-ahead implementation either in the old Flex version or the newer JavaScript version of eSearch and did not find it. Can you point me to an exampel of what you are currently using?

cmccullough2 commented 7 years ago

Shoot the wrong link copied. https://geonet.esri.com/docs/DOC-1731-enhanced-search-widget-version-211-080116. that is confusing. I am going to use your widget. It does everything I need it to do. I thought that looking through RS's code would help with the type-ahead function. It was only friendly help suggestion. This is the expression i am using in the config.json that allows for type-ahead, "sqltext": "Upper(arpt_name) LIKE Upper('%[value]%')", "operation": "stringOperatorIs", "uniquevalsfromfield": "arpt_name". I tried replacing ')' with '\' as your examples suggested. I could not get the query to work right. I may not be doing something correct on my end. It may not be your widget.

tmcgee commented 7 years ago

Thanks. I definitely took it as "friendly help". I would like to include type-ahead. That's the eSearch widget I assumed you were talking about. I saw this discussion in geonet which led me to believe that type-ahead isn't included with the eSearch widget either. I'll dive in further.

cmccullough2 commented 7 years ago

:) thank you