vdw / HideSeek

A simple, mobile-friendly, yet customizable quick/live search jQuery plugin.
http://vdw.github.io/HideSeek
Apache License 2.0
429 stars 74 forks source link

Finding "male" within "female" #50

Open zforsman opened 7 years ago

zforsman commented 7 years ago

I'm not exactly sure how to phrase this, but I'm using HideSeek to search through some adoptable animals, and would like users to be able to search by gender. Out of the box, if a user types "male" this also finds "female", which in return displays all animals. Which makes sense based on the functionality.

Just curious if there is a way around this using one of the options?

Thanks!

vdw commented 7 years ago

Hi, you can use the "matches" option in the latest version of HideSeek (v0.8.0) to exactly match a query to a result - here is an example.

Please let me know if that helped.

zforsman commented 7 years ago

Hi there, Finally got around to trying it out, but can't get it to work. "Female" now filters to only female results, but now "male" returns nothing. I am using attribute: 'title' if that makes any difference.

$( '#search' ).hideseek( {
   matches: {'^male$': '^male$'},
   nodata: 'There are no animals matching this criteria.',
   attribute: 'title'
} );

Thanks

vdw commented 7 years ago

Can you provide the list you are using or a jsfiddle example?

TwinArchelles commented 5 years ago

Am I able to search for content that is not in a list fomart? My website is shopimeals.epizy.com and I would like to be able to search all the restaurants in the "Popular" Section. How can I do it?

maxwroc commented 5 years ago

@zforsman I know your question is ancient but it should be working regardless if you use attribute option or not. I have just tested it (I did it though on my forked version)

@TwinArchelles it actually has a "list". You can use ".inner-sec-w3layouts-agileinfo" as a data-list attribute and the search should be working. You can use attribute on items (as @zforsman) to provide better search abilities e.g. you can add "keywords" attribute on each item and inside put keywords for people to search, this way people would be able to find "JamaicanJerky" item when they search for "chicken" (as long you will add 'keywords="JamaicanJerky chicken"' attribute on it)