Revision f187ebb7
b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java | ||
---|---|---|
1786 | 1786 |
|
1787 | 1787 |
@Override |
1788 | 1788 |
public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException { |
1789 |
long startTime = System.currentTimeMillis(); |
|
1789 | 1790 |
if (userId == null) |
1790 | 1791 |
throw new ObjectNotFoundException("No user specified"); |
1791 | 1792 |
User user = getUser(userId); |
1792 | 1793 |
if (query == null) |
1793 | 1794 |
throw new ObjectNotFoundException("No query specified"); |
1794 | 1795 |
List<FileHeader> files = search(user.getId(), query); |
1796 |
long startTime2 = System.currentTimeMillis(); |
|
1795 | 1797 |
List<FileHeaderDTO> res = new ArrayList<FileHeaderDTO>(); |
1796 | 1798 |
for(FileHeader f : files) |
1797 | 1799 |
res.add(f.getDTO()); |
1800 |
long stopTime2 = System.currentTimeMillis(); |
|
1801 |
logger.info("DTO time: " + (stopTime2 - startTime2)); |
|
1802 |
long stopTime = System.currentTimeMillis(); |
|
1803 |
logger.info("Total time: " + (stopTime - startTime)); |
|
1798 | 1804 |
return res; |
1799 | 1805 |
} |
1800 | 1806 |
|
... | ... | |
1812 | 1818 |
CommonsHttpSolrServer solr = new CommonsHttpSolrServer(getConfiguration().getString("solr.url")); |
1813 | 1819 |
SolrQuery solrQuery = new SolrQuery(escapeCharacters(normalizeSearchQuery(query))); |
1814 | 1820 |
solrQuery.setRows(maxRows); |
1821 |
long startTime = System.currentTimeMillis(); |
|
1815 | 1822 |
QueryResponse response = solr.query(solrQuery); |
1816 | 1823 |
SolrDocumentList results = response.getResults(); |
1817 | 1824 |
if (results.getNumFound() > maxRows) { |
... | ... | |
1819 | 1826 |
response = solr.query(solrQuery); |
1820 | 1827 |
results = response.getResults(); |
1821 | 1828 |
} |
1829 |
long stopTime = System.currentTimeMillis(); |
|
1830 |
logger.info("Search time:" + (stopTime - startTime)); |
|
1822 | 1831 |
User user = getUser(userId); |
1832 |
startTime = System.currentTimeMillis(); |
|
1823 | 1833 |
for (SolrDocument d : results) { |
1824 | 1834 |
Long id = Long.valueOf((String) d.getFieldValue("id")); |
1825 | 1835 |
try { |
... | ... | |
1830 | 1840 |
logger.warn("Search result id " + id + " cannot be found", e); |
1831 | 1841 |
} |
1832 | 1842 |
} |
1843 |
stopTime = System.currentTimeMillis(); |
|
1844 |
logger.info("Permission checks: " + (stopTime - startTime)); |
|
1833 | 1845 |
} catch (MalformedURLException e) { |
1834 | 1846 |
logger.error(e); |
1835 | 1847 |
throw new EJBException(e); |
Also available in: Unified diff