|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.factual.driver.Query
public class Query
Represents a top level Factual query. Knows how to represent the query as URL
encoded key value pairs, ready for the query string in a GET request. (See
toUrlQuery())
| Constructor Summary | |
|---|---|
Query()
|
|
| Method Summary | |
|---|---|
void |
add(Filter filter)
Adds filter to this Query. |
Query |
and(Query... queries)
Used to nest AND'ed predicates. |
QueryBuilder |
criteria(String field)
Deprecated. use field(String) |
QueryBuilder |
field(String field)
Begins construction of a new row filter for this Query. |
String[] |
getSelectFields()
|
Query |
includeRowCount()
The response will include a count of the total number of rows in the table that conform to the request based on included filters. |
Query |
includeRowCount(boolean includeRowCount)
When true, the response will include a count of the total number of rows in the table that conform to the request based on included filters. |
Query |
limit(long limit)
Sets the maximum amount of records to return from this Query. |
Query |
near(String text,
int meters)
|
Query |
offset(long offset)
Sets how many records in to start getting results (i.e., the page offset) for this Query. |
Query |
only(String... fields)
Sets the fields to select. |
Query |
or(Query... queries)
Used to nest OR'ed predicates. |
Query |
search(String term)
Sets a full text search query. |
Query |
sortAsc(String field)
Sets this Query to sort field in ascending order. |
Query |
sortDesc(String field)
Sets this Query to sort field in descending order. |
String |
toString()
|
protected String |
toUrlQuery()
Builds and returns the query string to represent this Query when talking to Factual's API. |
Query |
within(Circle circle)
Adds a filter so that results can only be (roughly) within the specified geographic circle. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Query()
| Method Detail |
|---|
public Query search(String term)
term - the text for which to perform a full text search.
public Query limit(long limit)
limit - the maximum amount of records to return from this Query.
public Query only(String... fields)
fields - the fields to select.
public String[] getSelectFields()
public Query sortAsc(String field)
field - the field to sort in ascending order.
public Query sortDesc(String field)
field - the field to sort in descending order.
public Query offset(long offset)
offset - the page offset for this Query.
public Query includeRowCount()
public Query includeRowCount(boolean includeRowCount)
includeRowCount - true if you want the results to include a count of the total
number of rows in the table that conform to the request based on
included filters.
@Deprecated public QueryBuilder criteria(String field)
field(String)
field - the name of the field on which to filter.
public QueryBuilder field(String field)
field - the name of the field on which to filter.
public Query near(String text,
int meters)
public Query within(Circle circle)
circle - The circle within which to bound the results.
public Query and(Query... queries)
public Query or(Query... queries)
public void add(Filter filter)
protected String toUrlQuery()
Example output:
filters=%7B%22%24and%22%3A%5B%7B%22region%22%3A%7B%22%24in%22%3A%22MA%2CVT%2CNH%22%7D%7D%2C%7B%22%24or%22%3A%5B%7B%22first_name%22%3A%7B%22%24eq%22%3A%22Chun%22%7D%7D%2C%7B%22last_name%22%3A%7B%22%24eq%22%3A%22Kok%22%7D%7D%5D%7D%5D%7D
(After decoding, the above example would be used by the server as:)
filters={"$and":[{"region":{"$in":"MA,VT,NH"}},{"$or":[{"first_name":{"$eq":"Chun"}},{"last_name":{"$eq":"Kok"}}]}]}
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||