Searching space token problem.

I read in the comment of template-function of getSearchWords() that "If tokens are separated by spaces, the OR function is presumed." That means putting space will be the same as , and | correct?
If that's not what it meant, how do I make it so when there's a space in the search field it's recognized as , and |
Like for this picture I tagged it as Tom, Smith and the title is Tom Smith. But when I type in "Smith Tom" it didn't show result, but if I do Smith, Tom it shows.
I know a little bit of php so I'll try to mess my way around in the mean time.

Thanks for any help!
Douten

Comments

  • You have read the comment correctly. Unfortunately, it is not correct. Comma or `|` is required to get the OR function. Strings not separated by an operator are considered one term.
  • Oh I get it. Tokens are like !, |, etc. so if it's "name & name" it'll be read as "name-or-and-or-name" right?
    Is there a way I can split the string at space characters so they can be read as two string? Like is I type "Smith Tim" the search will read it as "Smith|Tim".

    This will require learning on my part right? I'll go look at some php tutorials.
  • The tokens are `!` `&` `|` `,` `(` `)` You can also use `NOT` `AND` `OR` inplace of the `!`, `&` and `|` tokens. `,` is the same as `|`. Parens are used for grouping. `!` is unary. Space is part of the token. You can also place strings in quotations so that you can search on the string `"TOM & Jane" for an match of the full string.

    As I said, the document you found was not correct. Space is NOT the same as OR.
  • Okay, I think I've got an understanding of how the token works. How would I change it so that space is read as an OR token though? so a search of "Smith Tim" would show "Tim Smith" image up (if I have Tim, Smith for tags of the "Tim Smith" image).

    Thanks~ : )
  • You would have to modify the zenphoto core class-search.php file. Not a recommended tactic.
  • I see. I guess I'll just let the user know about the search tokens then~ Thanks : )
  • If anyone does try to modify the class-search file to make this happen it would be beyond amazing, this is a big problem for what I use Zenphoto for as my users are not patient enough to read an explanation on how to search for things :(
  • Please give tonight's nightly build a try. There is now an option to treat spaces as the OR operator.
  • RachelL Member
    Thank you for that sbillard, can't wait to try it out.

    -Rachel
Sign In or Register to comment.