001
014
015 package com.liferay.portal.kernel.search;
016
017 import com.liferay.portal.kernel.util.StringPool;
018
019 import java.util.Collections;
020 import java.util.List;
021 import java.util.Map;
022
023
027 public class DummyIndexSearcher implements IndexSearcher {
028
029 @Override
030 public Hits search(SearchContext searchContext, Query query) {
031 return _getHits();
032 }
033
034 @Override
035 public Hits search(
036 String searchEngineId, long companyId, Query query, Sort[] sort,
037 int start, int end) {
038
039 return _getHits();
040 }
041
042 @Override
043 public String spellCheckKeywords(SearchContext searchContext) {
044 return StringPool.BLANK;
045 }
046
047 @Override
048 public Map<String, List<String>> spellCheckKeywords(
049 SearchContext searchContext, int max) {
050
051 return Collections.emptyMap();
052 }
053
054 @Override
055 public String[] suggestKeywordQueries(
056 SearchContext searchContext, int max) {
057
058 return new String[0];
059 }
060
061 private Hits _getHits() {
062 Hits hits = new HitsImpl();
063
064 hits.setCollatedSpellCheckResult(StringPool.BLANK);
065 hits.setDocs(new Document[0]);
066 hits.setLength(0);
067 hits.setQuery(new StringQueryImpl(StringPool.BLANK));
068 hits.setQuerySuggestions(new String[0]);
069 hits.setQueryTerms(new String[0]);
070 hits.setLength(0);
071 hits.setScores(new float[0]);
072 hits.setSearchTime(0);
073 hits.setSnippets(new String[0]);
074 hits.setSpellCheckResults(_spellCheckResults);
075 hits.setStart(0);
076
077 return hits;
078 }
079
080 private static Map<String, List<String>> _spellCheckResults =
081 Collections.emptyMap();
082
083 }