# Best way to build a query?

**URL:** <https://www.ruby-forum.com/t/best-way-to-build-a-query/126098>\
**Category:** Ferret\
**Created:** [January 15, 2008, 12:57pm UTC](https://www.ruby-forum.com/t/best-way-to-build-a-query/126098 "2008-01-15T12:57:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bunny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3d9bf3/32.png) [@bunny](https://www.ruby-forum.com/u/bunny)\
**Post date:** [January 15, 2008, 12:57pm UTC](https://www.ruby-forum.com/t/best-way-to-build-a-query/126098/1 "2008-01-15T12:57:54Z")

</div>

Hello,

I am currently taking various users parameters and build an FQL query.  
For example, I I was given:

query = “indian reservation”

date: 20050101 to 20070303

location = USA

Human version: Get all of the documents containing “indian reservation”  
which were published between 20050101 to 20070303 in the USA

FQL: +content:(indian reservation) +date:{20050101 20070303}  
+location:(usa)

Is there a better way to do this building queries using the query  
functions?

Benjamin

---

<div class="post-metadata">

**Author:** ![bunny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3d9bf3/32.png) [@bunny](https://www.ruby-forum.com/u/bunny)\
**Post date:** [February 14, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/best-way-to-build-a-query/126098/2 "2008-02-14T23:01:07Z")

</div>

Benjamin A. wrote:

> Hello,
> 
> I am currently taking various users parameters and build an FQL query.  
> For example, I I was given:
> 
> query = “indian reservation”
> 
> date: 20050101 to 20070303
> 
> location = USA
> 
> Human version: Get all of the documents containing “indian reservation”  
> which were published between 20050101 to 20070303 in the USA
> 
> FQL: +content:(indian reservation) +date:{20050101 20070303}  
> +location:(usa)
> 
> Is there a better way to do this building queries using the query  
> functions?
> 
> Benjamin

you should quote the strings: content:“indian reservation” AND  
location:“usa”
