If you enable it, I'll have a look. I did manage to get a copy of the code but it's old. There is a lot of code for something as simple as a product search type-ahead ... so I'd be interested in seeing all it can do.
advanced search by type ahead
- zipurman
- Builder
- Posts: 540
- Joined: Tue Oct 13, 2020 5:20 pm
- Phoenix Version: v
- Has thanked: 93 times
- Been thanked: 162 times
Re: advanced search by type ahead
zipurman
-----------
-----------
-
Omar_one
- Senior Contributor
- Posts: 677
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: advanced search by type ahead
you can check it out
- zipurman
- Builder
- Posts: 540
- Joined: Tue Oct 13, 2020 5:20 pm
- Phoenix Version: v
- Has thanked: 93 times
- Been thanked: 162 times
Re: advanced search by type ahead
Thanks Omar and all who have PM'd me.
I will have a look at the code and get this working on latest Phoenix next week.
I will have a look at the code and get this working on latest Phoenix next week.
zipurman
-----------
-----------
- zipurman
- Builder
- Posts: 540
- Joined: Tue Oct 13, 2020 5:20 pm
- Phoenix Version: v
- Has thanked: 93 times
- Been thanked: 162 times
Re: advanced search by type ahead
I have started a re-code of the type-ahead here: https://phoenixaddons.com/demostore/
Currently it's a single hook of 300 lines. I plan on expanding it into a mod so it can be configured. What settings do you feel would be needed? I am releasing this one as a free mod, so any input is appreciated.
Zip
Currently it's a single hook of 300 lines. I plan on expanding it into a mod so it can be configured. What settings do you feel would be needed? I am releasing this one as a free mod, so any input is appreciated.
Zip
zipurman
-----------
-----------
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: advanced search by type ahead
@zipurman I dont know if this one does it, but I always thought it would be cool to sort the returned result by the position of the search string, eg;
canada
france
andorra
afghanistan
Let's say that the typeahead was "an"
the result would be
andorra
canada
france
afghanistan
I did have some effort at doing this a few years ago, but never really took it forward to somehting useful, here's the code I played with;
canada
france
andorra
afghanistan
Let's say that the typeahead was "an"
the result would be
andorra
canada
france
afghanistan
I did have some effort at doing this a few years ago, but never really took it forward to somehting useful, here's the code I played with;
Code: Select all
SELECT
products_id,
products_name,
position("an" in products_name) as pos
FROM
products_description
WHERE
products_name like '%an%'
ORDER BY posI am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
- zipurman
- Builder
- Posts: 540
- Joined: Tue Oct 13, 2020 5:20 pm
- Phoenix Version: v
- Has thanked: 93 times
- Been thanked: 162 times
Re: advanced search by type ahead
@burt thanks for the idea. I am matching several fields and also replacing spaces with % to allow wider matching. I love the idea and will do some logic to do what you suggest post SQL as I am already looping the data prior to showing it. Thanks for the idea!
zipurman
-----------
-----------
- zipurman
- Builder
- Posts: 540
- Joined: Tue Oct 13, 2020 5:20 pm
- Phoenix Version: v
- Has thanked: 93 times
- Been thanked: 162 times
Re: advanced search by type ahead
I have added some more functionality, use the link above to preview.
- Type-ahead suggestion if searching name or model
- Some style updates
- sorting by relevance as well as type ahead offering best match
- loose focus closes dropdown
- regain focus pops open dropdown if search is not empty
- retain upper/lower on highlights
- remove html from result to avoid highlights breaking code
- remove html from search matching (searching for strong etc)
Still a single hook file. Will move to a mod once I get it so all required features are covered. Haven't had much feedback ...
- Type-ahead suggestion if searching name or model
- Some style updates
- sorting by relevance as well as type ahead offering best match
- loose focus closes dropdown
- regain focus pops open dropdown if search is not empty
- retain upper/lower on highlights
- remove html from result to avoid highlights breaking code
- remove html from search matching (searching for strong etc)
Still a single hook file. Will move to a mod once I get it so all required features are covered. Haven't had much feedback ...
zipurman
-----------
-----------
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: advanced search by type ahead
Looks good!
A suggestion could be to make it possible to include categories in the results. Potentially also info pages, but I don't know if that would be slowing things down too much and require a modularized adcanced_search_results (similar to the fuzzy-search supporters code) with modules to show these alternative hits.
//Daniel
A suggestion could be to make it possible to include categories in the results. Potentially also info pages, but I don't know if that would be slowing things down too much and require a modularized adcanced_search_results (similar to the fuzzy-search supporters code) with modules to show these alternative hits.
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: advanced search by type ahead
Certainly looks and behaves well with some very cool features.
We would second the suggestion for including search to Categories Title/Categories Description and InfoPages Text.
- tessthepup
- Certified Developer
- Posts: 382
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: advanced search by type ahead
@zipurmanheatherbell wrote: ↑Sat Jan 28, 2023 7:58 amCertainly looks and behaves well with some very cool features.
We would second the suggestion for including search to Categories Title/Categories Description and InfoPages Text.
Hi Preston, I echo everything said above but from a pure aesthetic point of view either give the option of showing 'show all results' & 'advanced search top or bottom of the results.
I personally would have those links at the bottom so not to distract from the products.