Skip to content

Commit

Permalink
remove unused CrateSearchService
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed May 7, 2015
1 parent 35c1c7e commit 64940d4
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 1,018 deletions.
334 changes: 0 additions & 334 deletions sql/src/main/java/io/crate/action/sql/query/CrateSearchService.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate licenses
* this file to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/

package io.crate.action.sql.query;

import io.crate.analyze.OrderBy;
import io.crate.operation.collect.CollectInputSymbolVisitor;
import io.crate.operation.reference.doc.lucene.LuceneCollectorExpression;
import io.crate.planner.symbol.Symbol;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.elasticsearch.search.internal.SearchContext;

import javax.annotation.Nullable;
import java.util.List;

public class LuceneSortGenerator {

@Nullable
private static Sort generateLuceneSort(SearchContext context,
List<Symbol> symbols,
boolean[] reverseFlags,
Boolean[] nullsFirst,
SortSymbolVisitor sortSymbolVisitor) {
if (symbols.isEmpty()) {
return null;
}
SortField[] sortFields = sortSymbolVisitor.generateSortFields(symbols, context, reverseFlags, nullsFirst);
return new Sort(sortFields);
}

@Nullable
public static Sort generateLuceneSort(SearchContext context,
OrderBy orderBy,
CollectInputSymbolVisitor<LuceneCollectorExpression<?>> inputSymbolVisitor) {
SortSymbolVisitor sortSymbolVisitor = new SortSymbolVisitor(inputSymbolVisitor);
return generateLuceneSort(context, orderBy.orderBySymbols(), orderBy.reverseFlags(), orderBy.nullsFirst(), sortSymbolVisitor);
}
}
Loading

0 comments on commit 64940d4

Please sign in to comment.