Revision 55639
Added by Katerina Iatropoulou almost 5 years ago
SearchServiceImpl.java | ||
---|---|---|
119 | 119 |
} catch (Exception e) { |
120 | 120 |
logger.error("Fail to load search service profile with id " + serviceId + " from IS.", e); |
121 | 121 |
} |
122 |
|
|
122 | 123 |
} |
123 | 124 |
|
124 | 125 |
@Override |
... | ... | |
279 | 280 |
|
280 | 281 |
String query = rewrite(text); |
281 | 282 |
enhanceFieldQueries(fieldQueries); |
283 |
logger.info("Performing cursor query " + query + "' and fields " + fieldQueries + " and refine " + refinefields); |
|
282 | 284 |
logger.debug("Performing cursor query " + query + "' and fields " + fieldQueries + " and refine " + refinefields); |
283 | 285 |
|
284 | 286 |
|
... | ... | |
379 | 381 |
return queryBuffer.append(facetsBuffer.toString()).append(fqBuffer.toString()).toString(); |
380 | 382 |
} |
381 | 383 |
|
384 |
|
|
385 |
//TODO: I wish to remove this. This was only made (quick and dirty - only the enhanceFieldQueries(fieldQueries) is missing |
|
386 |
//from newSearch() after a last time request for the portal to show all the publications and the deletedbyinference ones. |
|
387 |
//I did not want to pass a parameter since I do not know if we are going to keep it. This is for a tech meeting showcase. |
|
388 |
//If we want to keep this I need to redesign. |
|
389 |
|
|
390 |
public SearchResult newSearchWithoutFieldQueries (String text, String locale, List<String> refinefields, List<String> fieldQueries, |
|
391 |
int from, int to, String format, Transformer transformer, Transformer oldRefineTransformer, |
|
392 |
boolean oldPaging) throws SearchServiceException { |
|
393 |
logger.info("non filtered search for... > from: " + from + " to:" + to); |
|
394 |
long startTime = System.nanoTime(); |
|
395 |
|
|
396 |
IndexService index = getIndexLocator().getService(); |
|
397 |
|
|
398 |
EPR epr = null; |
|
399 |
ResultSet<String> rs = null; |
|
400 |
|
|
401 |
List<String> browseResults = null; |
|
402 |
List<String> searchResults = null; |
|
403 |
|
|
404 |
String query = rewrite(text); |
|
405 |
logger.info("Performing query " + query + "' and fields " + fieldQueries + " and refine " + refinefields); |
|
406 |
|
|
407 |
try { |
|
408 |
//TODO see parser and maybe delete! |
|
409 |
//query = new CQLParser().parse(query).toCQL(); |
|
410 |
String eprQuery = createEprQuery(query, refinefields, fieldQueries); |
|
411 |
|
|
412 |
epr = index.getBrowsingStatistics(eprQuery, "all", mdFormat, indexLayout); |
|
413 |
|
|
414 |
if (epr == null) { |
|
415 |
throw new SearchServiceException("Something really strange happened there! Index returned null result set id."); |
|
416 |
} |
|
417 |
|
|
418 |
//get the locale TODO do we need this? |
|
419 |
//String correctLocale = getCorrectLocale(locale); |
|
420 |
//StringTokenizer tokenizer = new StringTokenizer(correctLocale, "_"); |
|
421 |
//Locale requestLocale = new Locale(tokenizer.nextToken(), tokenizer.nextToken()); |
|
422 |
|
|
423 |
rs = rsFactory.createResultSet(epr); |
|
424 |
|
|
425 |
Map<String, List<String>> list = null; |
|
426 |
if (oldPaging) { |
|
427 |
list = ((SolrResultSet)rs).newGet(from-1, to, format, transformer, oldRefineTransformer); |
|
428 |
|
|
429 |
} else { |
|
430 |
list = ((SolrResultSet)rs).newGet(from, to, format, transformer, oldRefineTransformer); |
|
431 |
} |
|
432 |
|
|
433 |
|
|
434 |
searchResults = list.get("search"); |
|
435 |
browseResults = list.get("refine"); |
|
436 |
|
|
437 |
} catch (IndexServiceException ise) { |
|
438 |
logger.error("Error getting refine results.", ise); |
|
439 |
throw new SearchServiceException("Error getting refine results.", ise); |
|
440 |
|
|
441 |
} |
|
442 |
|
|
443 |
long estimatedTime = System.nanoTime() - startTime; |
|
444 |
logger.debug("Search time " + estimatedTime/1000000 + " milliseconds for query " + query + |
|
445 |
" and fields " + fieldQueries + " and refine " + refinefields + " from: "+ from + " and size " + to); |
|
446 |
|
|
447 |
//logger.info("Returned results for NEW search query '" + query + "' and fields " + fieldQueries + " and refine " + refinefields);; |
|
448 |
rs.close(); |
|
449 |
return new SearchResult(query, Locale.getDefault().toString(), rs.size(), from, to, searchResults, browseResults, refinefields); |
|
450 |
} |
|
451 |
|
|
452 |
|
|
382 | 453 |
public String getMdFormat() { |
383 | 454 |
return mdFormat; |
384 | 455 |
} |
Also available in: Unified diff
Latest for solr7 + deletedByInferencePublications method added #4216