CrescentSearchRequestWrapper { public List<CrescentCollectionField> getTargetSearchFields() { if(searchFields.size() > 0) { return searchFields; } if(searchRequest.getSearchField() != null && !"".equals(searchRequest.getSearchField())) { String[] requestSearchField = searchRequest.getSearchField().split(","); for(String fieldName : requestSearchField) { CrescentCollectionField field = collectionFieldsMap.get(fieldName); if(field == null) { throw new IllegalStateException("There is no Field in Collection [" + searchRequest.getCollectionName() + "] [" + fieldName + "]"); } searchFields.add(collectionFieldsMap.get(fieldName)); } } else { for(CrescentDefaultSearchField f : collection.getDefaultSearchFields()) { searchFields.add(collectionFieldsMap.get(f.getName())); } } return searchFields; } CrescentSearchRequestWrapper(SearchRequest searchRequest); String getKeyword(); String getCollectionName(); int getDefaultHitsPage(); int getPageNum(); int getStartOffSet(); int getHitsForPage(); Sort getSort(); Query getQuery(); Filter getFilter(); List<CrescentCollectionField> getTargetSearchFields(); List<CrescentCollectionField> getIndexedFields(); String getUserIp(); String getUserId(); String getPcId();  }
@Test public void getSearchFieldNames() { CrescentSearchRequestWrapper searchRequestWrapper = new CrescentSearchRequestWrapper(searchRequest); List<CrescentCollectionField> searchFields = searchRequestWrapper.getTargetSearchFields(); String result = "["; for(CrescentCollectionField f : searchFields) { result += f.getName() + ", "; } result += "]"; Assert.assertEquals("[title, dscr, ]", result); }