|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.ornl.csed.csiir.idr.kdd.dataservice.server.models.DataSetQueryRequest
public final class DataSetQueryRequest
The DataSetQueryRequest class represents a query to be submitted to the data service. Boolean queries that search across all of a data set's fields may be constructed, as well as, boolean queries that target specific fields.
A query that searches across all of a data set's fields that would represent this query '((("bin laden" AND Usama) OR ("bin laden" AND Osama)) AND NOT mohamed)' could be built using the following code:
QueryNode frag1 = QueryNode.createAndNode(
QueryNode.createKeywordNode("bin laden"),
QueryNode.createKeywordNode("Usama"));
QueryNode frag2 = QueryNode.createAndNode(
QueryNode.createKeywordNode("bin laden"),
QueryNode.createKeywordNode("Osama"));
QueryNode frag3 = QueryNode.createOrNode(
frag1,
frag2);
QueryNode frag4 = QueryNode.createNotNode(
QueryNode.createKeywordNode("mohamed"));
QueryNode query = QueryNode.createAndNode(
frag3,
frag4);
DataSetQueryRequest dataSetQueryRequest = new DataSetQueryRequest(query);
To constrain a keyword value so that is it compared only to a specific field, create the keyword node as follows:
QueryNode.createKeywordNode("fieldName", "keyword");
Nested Class Summary | |
---|---|
static class |
DataSetQueryRequest.QueryNode
The QueryNode class represents a node of a boolean query. |
Constructor Summary | |
---|---|
DataSetQueryRequest()
|
|
DataSetQueryRequest(DataSetQueryRequest.QueryNode query)
|
Method Summary | |
---|---|
void |
addReturnField(java.lang.String field)
Add a field to the list of field values to retrieve. |
boolean |
equals(java.lang.Object obj)
|
long |
getMaxRecords()
Retrieve the maximum requested number of records. |
java.lang.String |
getQueryId()
Retrieve the unique identifier associated with this query |
java.util.Queue<java.lang.String> |
getQueue()
Retrieve the query in queue form. |
java.util.List<java.lang.String> |
getReturnFields()
Retrieve the list of field values to be retrieved. |
boolean |
getReturnScore()
Retrieve the value of the flag for returning the Lucene score. |
int |
hashCode()
|
void |
removeReturnField(java.lang.String field)
Remove a field from the list of field values to retrieve. |
void |
setMaxRecords(long maxRecords)
Set the maximum records to retrieve. |
void |
setQuery(DataSetQueryRequest.QueryNode query)
Set the query associated with this request. |
void |
setQueryId(java.lang.String queryId)
Set the unique identifier associated with this query. |
void |
setQueue(java.util.Queue<java.lang.String> queue)
Set the query in queue form. |
void |
setReturnFields(java.util.List<java.lang.String> returnFields)
Set the list of field values to be retrieved. |
void |
setReturnScore(boolean getScore)
Add the score field to the field values retrieved. |
java.lang.String |
toQueryString(java.util.Map<java.lang.String,java.lang.String> searchFields)
Converts the query to an appropriate string form given the supplied search field map. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DataSetQueryRequest()
public DataSetQueryRequest(DataSetQueryRequest.QueryNode query)
Method Detail |
---|
public java.lang.String getQueryId()
public void setQueryId(java.lang.String queryId)
queryId
- the unique query IDpublic void setQuery(DataSetQueryRequest.QueryNode query)
query
- the query nodepublic java.util.Queue<java.lang.String> getQueue()
public void setQueue(java.util.Queue<java.lang.String> queue)
queue
- the query in queue formpublic java.lang.String toQueryString(java.util.Map<java.lang.String,java.lang.String> searchFields) throws KDDDataServiceException
searchFields
- a map of search fields to their field type
KDDDataServiceException
public long getMaxRecords()
public void setMaxRecords(long maxRecords)
maxRecords
- the maximum number of records to retrievepublic void addReturnField(java.lang.String field)
field
- the field namepublic void removeReturnField(java.lang.String field)
field
- the field namepublic java.util.List<java.lang.String> getReturnFields()
public void setReturnFields(java.util.List<java.lang.String> returnFields)
returnFields
- the list of field namespublic void setReturnScore(boolean getScore)
getScore
- the boolean to retrieve the Lucene scorepublic boolean getReturnScore()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |