searchable icon indicating copy to clipboard operation
searchable copied to clipboard

Multiple search terms

Open sergiocastrovale opened this issue 9 years ago • 5 comments

How should I use the package for multiple search terms?

For instance, if I'm searching for textures and write "metal golden" where "metal" something belonging to the Category table, while "golden" belongs to the Tag table, I'm only getting results which conform to metal, but the search ends there.

This is quite urgent, so any help is appreciated.

sergiocastrovale avatar May 04 '15 14:05 sergiocastrovale

why not search both models and then merge your two returned collections?

gregory-claeyssens avatar May 06 '15 09:05 gregory-claeyssens

Because this would force the app to run N queries for N search terms and array_merge those N collections. Or perhaps I didn't understand correctly?

sergiocastrovale avatar May 06 '15 09:05 sergiocastrovale

you have n terms on 2 models, that would be 2*n queries, with array_merge 2 collections

gregory-claeyssens avatar May 06 '15 10:05 gregory-claeyssens

@GregoryClaeyssens I'm having an urgent issue - maybe you could help me with this. So, if I search for "wood" (a tag), I get 20 results. However if I search for "worn wood", instead of narrowing down my search, I'm getting even more results. I think this has an OR logic instead of an AND logic. Is there any way to go around it? Thanks!

sergiocastrovale avatar Jul 14 '15 11:07 sergiocastrovale

@sergiocastrovale that's possible here https://github.com/ajcastro/searchable

ajcastro avatar Feb 23 '19 12:02 ajcastro