This patch allows filters to search by any word or by all words. within a field.

I use this for a search filter so that it gives the ability to search for names in entered in any order eg.

Doe, John or John Doe will both find the field that contains Doe, John

See http://www.visualarts.net.au/gallery/listing for an example of this working.

CommentFileSizeAuthor
#3 views_like.patch_0.txt2.19 KBgordon
views_like.patch.txt1.72 KBgordon

Comments

yched’s picture

Seems interesting.

Just a few remarks :
- From the code and from the example url you provide :
It seems this is not actually a "word search" : if I type "temp", I match "contemporary art"
- your clear the characters ",?!" from the search "words". Why not other punctuation symbols (;:-) ?

merlinofchaos’s picture

I'm holding off on committing this functionality until yched's comments are addressed, but I am ok with it.

gordon’s picture

StatusFileSize
new2.19 KB

1. Yes it isn't really a word search, but it splits the query up into words before appling them to a contained in. I did think adding spaces to each side, but then this will exclude works with something right after them like a ,. The use of the term word search is in want of a better name.

2. I had no reason for excluding them. I have added them.

I have changed the patch so that you can do things like add " around text, to make it a bit more searchy.

yched’s picture

Yes, a real "word search" is tricky with MySQL...

merlinofchaos’s picture

Commited to 5 and 4.7 branches; will go out in 5-1.1-beta and 4.7-1.1

merlinofchaos’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)