# Using single character 'a' as a search term

**URL:** <https://www.ruby-forum.com/t/using-single-character-a-as-a-search-term/149282>\
**Category:** Ferret\
**Created:** [September 23, 2008, 9:39am UTC](https://www.ruby-forum.com/t/using-single-character-a-as-a-search-term/149282 "2008-09-23T09:39:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![asmodi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a183cd/32.png) [@asmodi](https://www.ruby-forum.com/u/asmodi)\
**Post date:** [September 23, 2008, 9:39am UTC](https://www.ruby-forum.com/t/using-single-character-a-as-a-search-term/149282/1 "2008-09-23T09:39:07Z")

</div>

Hi all,

This is a weird problem that I will try to explain in my own way.

I construct my search query by including all possible indexed fields and  
using the wildcard if the user hasn’t provided data for a field. Eg if  
the indexed fields are “surname”, “first\_name” and “second\_name” and the  
user has only provided data in the surname and first\_name fields the  
query would be:

“surname:Smith AND first\_name:John AND second\_name:\*”

This seems to work fine unless I use a single character ‘a’ exclusively  
in any, some or all of the fields. So say I enter an ‘a’ in surname with  
the query being:

“surname:a AND first\_name:\* AND second\_name:\*”

I get a result containing every record from my data set. If for example  
I use any other character (or multiple characters) in the surname field  
such as:

“surname:b AND first\_name:\* AND second\_name:\*”

I get no results, which I assume is correct because I have no people in  
my data set with a surname of “b”.

This same problem applies to any of the indexed fields. Here’s some more  
examples:

“surname:a AND first\_name:a AND second\_name:a” gives every record  
“surname:a AND first\_name:a AND second\_name:\*” gives every record

“surname:a AND first\_name:b AND second\_name:\*” gives no records which I  
expect  
“surname:a” gives no records which I expect

Any idea’s what might be going on here?
