Download & Extend

Searching help desperately needed on search page

Project:Drupal core
Version:7.7
Component:search.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Few users know the power and flexibility of the search syntax. The search.module currently supports an implied AND between words with an optional, phrases and exclusionary terms. I propose two changes:

  1. Add a help link to to the search page.
  2. As an adventurous user, I tried using lower case "or" and when this didn't work, I didn't try it again. We could improve this user experience by either (a) supporting case-insensitive OR, or (b) add a warning message to the user when one of the terms is lower case 'or'. Google does the latter, using the message "Try uppercase 'OR' to search for either of two terms." However, Google also searches for or=OR=Oregon. Since we exclude terms that are 3 characters or less (this is configurable, but 3 characters is the default), I think that option (a) is better for Drupal.

Comments

#1

This issue was culled from #145560 where Steven said "... changing the OR operator to be case insensitive ... This was in fact an intentional design choice, and follows what search engines like Google do."

#2

Version:6.x-dev» 7.x-dev

Well stated issue.

#3

Title:Improve User Experience of search syntax» USABILITY: search syntax help link and lowercase OR message

More explicit title.

#4

Title:USABILITY: search syntax help link and lowercase OR message» USABILITY: search syntax help link

The lower case OR warning snuck in the search patch, so this issue is now only about a help link.

#5

Component:search.module» usability

Moving all usability issues to Drupal - component usability.

#6

Title:USABILITY: search syntax help link» Add note about AND and OR as help on the search page
Version:7.x-dev» 8.x-dev
Component:usability» search.module

This is either a feature request (please add help) or a bug report (search is unusable without the help). If it's a feature request, at this point it gets pushed off to Drupal 8. If you think it's a bug report, please feel free to move it back to D7 and mark it as such. Can we keep it in the search issue queue though? There is actually not a usability component any more.

Just as a note, we already have help saying this if the search returns no results:
'

  • Check if your spelling is correct.
  • Remove quotes around phrases to search for each word individually. bike shed will often show more results than "bike shed".
  • Consider loosening your query with OR. bike OR shed will often show more results than bike shed.

#8

Title:Add note about AND and OR as help on the search page» Searching help desperately needed on search page
Version:8.x-dev» 7.x-dev
Category:feature request» bug report

I decided to close that other issue as a duplicate of this one, and move this to 7.x as a bug report.

The reason is I keep discovering new quirks of searching that are not transparent to the user. So this is what I think we need to display somewhere for the user:
- AND, and, and OR are keywords for boolean searches. or is not used as a boolean keyword (this was decided a while back, not by me, in an issue, and no I have no idea why they would allow lower-case and but not lower-case or to be a boolean keyword?).
- A keyword preceded by a hyphen means "not keyword". This also applies if the first word of a phrase starts with - (WTF? Should be -"hello this is a phrase", not "-hello this is a phrase", but that's not what the code does).
- Punctuation is removed from all numeric items, so that e.g. 01/02/2009 will match 01-02-2009.
- Phrases in quotes must match exactly, except that they are first run through some, but not all, search preprocessing (WTF?).

#9

Clarification on numeric punctuation: Only punctuation inside the number is removed (number)(punctuation)(number), not (number)(punctuation) or (punctuation)(number). However, all . _ - are also removed during search indexing, and also during searching except that an initial - means "not keyword".

Which basically means that if you want to search for a negative number for some reason, you should search for the positive version of it, because there is no way to tell search.module that you really want to look for the string -2345, and anyway in the search index it's stored as 2345.

#10

Also, we should mention in the help you get when you have no search results that you need to have at least one search keyword (as opposed to AND, OR, or an "exclude from search" keyword) that is at least N letters long *after preprocessing* (where N is the minimum word size the site has defined).

And we need to make sure in the help that AND and OR are not translated inadvertently by translators, by using @ or % substitution in the text.

#11

A couple more notes:

a) "You must include at least one positive keyword with 3 characters or more." is the current message you get if you don't have anything search decides is a keyword, and it shows up as a form error. Generated from SearchQuery::executeFirstPass() in modules/search/search.extender.inc

b) The help text for no results from #6 is now easy to override in the theme.

#12

Version:7.x-dev» 7.7

I'm experiencing a white screen result when searching using two terms and lowercase 'or'.

uppercase OR functions as expected.

I also have Views is overriding the default results page in case that has any bearing.