Search in sources :

Example 1 with OQueryOperatorIn

use of com.orientechnologies.orient.core.sql.operator.OQueryOperatorIn in project orientdb by orientechnologies.

the class OLuceneOperatorUtil method createIndexedProperty.

public static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) {
    if (iItem == null || !(iItem instanceof OSQLFilterItemField))
        return null;
    if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField)
        return null;
    final OSQLFilterItemField item = (OSQLFilterItemField) iItem;
    if (item.hasChainOperators() && !item.isFieldChain())
        return null;
    final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft();
    if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) {
        return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue);
    }
    final Object value = OSQLHelper.getValue(origValue);
    if (value == null)
        return null;
    return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value);
}
Also used : OQueryOperatorIn(com.orientechnologies.orient.core.sql.operator.OQueryOperatorIn) OSQLFilterItemField(com.orientechnologies.orient.core.sql.filter.OSQLFilterItemField) OIndexSearchResult(com.orientechnologies.orient.core.sql.OIndexSearchResult) OQueryOperatorBetween(com.orientechnologies.orient.core.sql.operator.OQueryOperatorBetween)

Aggregations

OIndexSearchResult (com.orientechnologies.orient.core.sql.OIndexSearchResult)1 OSQLFilterItemField (com.orientechnologies.orient.core.sql.filter.OSQLFilterItemField)1 OQueryOperatorBetween (com.orientechnologies.orient.core.sql.operator.OQueryOperatorBetween)1 OQueryOperatorIn (com.orientechnologies.orient.core.sql.operator.OQueryOperatorIn)1