|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.labs.minion.query.Element
public abstract class Element
An abstract class for an element in a query: the elements of a query are terms, operators, relations and ranges.
| Field Summary | |
|---|---|
protected java.util.Set<java.lang.String> |
fields
The fields to which this element should be restricted during search. |
protected boolean |
strict
Whether this element should be interpreted in a strict boolean fashion. |
| Constructor Summary | |
|---|---|
Element()
|
|
| Method Summary | |
|---|---|
void |
addField(java.lang.String field)
Adds a field restriction to this element. |
java.util.Set<java.lang.String> |
getFields()
|
abstract QueryElement |
getQueryElement()
Transduces this query element into a "real" query element, one that can be evaluated by the search engine. |
boolean |
getStrict()
Gets the strictness of this element. |
void |
setFields(java.util.Collection<java.lang.String> fields)
Adds a number of field restrictions to the element. |
void |
setStrict(boolean strict)
Indicates whether this element should be evaluated in a strict boolean context. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean strict
protected java.util.Set<java.lang.String> fields
| Constructor Detail |
|---|
public Element()
| Method Detail |
|---|
public void setStrict(boolean strict)
Additionally, combining the results of an element evaluated in a strict boolean context with the results of an element evaluted in a normal context will not result in any change of score for the other results.
In this way, an element evaluated in a strict boolean context can be used to restrict a search without affecting the scores assigned to documents.
strict - if true if this element should be evaluated in a strict
bolean contextpublic boolean getStrict()
true if this element should be evaluated in a strict
bolean context, false otherwise.public void addField(java.lang.String field)
Multiple fields can be added as restrictions. In this case, the field restriction will be satisfied if the element can be satisfied in any of the fields.
For example, the query created using the following code:
Term t = new Term("dog");
t.addField("title");
t.addField("body");
would return documents where the word dog occurs in the title
of the document or the body (or both).
field - the field to which we wish to restrict the search.setFields(java.util.Collection)public void setFields(java.util.Collection<java.lang.String> fields)
For example, the query created using the following code:
Term t = new Term("dog");
Set s = new HashSet();
s.add("title");
s.add("dog");
t.setFields(s);
would return documents where the word dog occurs in the title
of the document or the body (or both). * @param fields
public java.util.Set<java.lang.String> getFields()
public abstract QueryElement getQueryElement()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||