# Partial term query by default

**URL:** <https://www.ruby-forum.com/t/partial-term-query-by-default/109894>\
**Category:** Ferret\
**Created:** [July 19, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/partial-term-query-by-default/109894 "2007-07-19T23:34:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![railsroad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e274bd/32.png) [@railsroad](https://www.ruby-forum.com/u/railsroad)\
**Post date:** [July 19, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/partial-term-query-by-default/109894/1 "2007-07-19T23:34:19Z")

</div>

My customers seem to expect that the world of search is dictated by  
Google. As such they expect all queries except phrase queries to  
include partial term hits. In other words, searching on “test” also  
returns “testing”.

Is there a quick option to enable this or anyway more elegant than  
gsub’ing the query to add asterisks around each term (except those in  
phrases of course)?

Thanks,

-bryan

---

<div class="post-metadata">

**Author:** ![railsroad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e274bd/32.png) [@railsroad](https://www.ruby-forum.com/u/railsroad)\
**Post date:** [July 20, 2007, 10:29am UTC](https://www.ruby-forum.com/t/partial-term-query-by-default/109894/2 "2007-07-20T10:29:15Z")

</div>

On Thu, Jul 19, 2007 at 11:34:19PM +0200, Bryan Wilkerson wrote:

> My customers seem to expect that the world of search is dictated by  
> Google. As such they expect all queries except phrase queries to  
> include partial term hits. In other words, searching on “test” also  
> returns “testing”.

With a Stemmer included in your analyzer ‘testing’ would actually be  
indexed as ‘test’ and therefore get found with a query for ‘test’.  
Of course this won’t help if you expect to find ‘tree’ when searching  
for ‘tr’, in this case you’ll have to build wildcard queries from the  
terms of the query.

Here’s an example for a custom analyzer using a StemFilter:

[http://www.ruby-forum.com/topic/90606#new](http://www.ruby-forum.com/topic/90606#new)

Jens

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa
