Revision 47418
Added by Argiro Kokogiannaki almost 7 years ago
search.php | ||
---|---|---|
884 | 884 |
// $ids the project identifiers |
885 | 885 |
// $locale the locale to use |
886 | 886 |
// return an array of project (object) or NULL if no such projects exists |
887 |
public function getProjectByCodeId($id, $locale) { |
|
887 |
public function getProjectByCodeId($id, $funder, $locale) {
|
|
888 | 888 |
if ($this->cache->getCaching()) { |
889 |
$cacheId = self :: PROJECT_CACHE_ID . '.' . $id . '.' . $locale; |
|
889 |
$cacheId = self :: PROJECT_CACHE_ID . '.' . $id . '.' . $funder . '.' . $locale;
|
|
890 | 890 |
$projects = $this->cache->get($cacheId, self :: CACHE_GROUP); |
891 | 891 |
if ($projects === FALSE) { |
892 |
$projects = $this->_getProjectByCodeId($id, $locale); |
|
892 |
$projects = $this->_getProjectByCodeId($id, $funder, $locale);
|
|
893 | 893 |
if ($projects !== NULL) |
894 | 894 |
$this->cache->store($projects, $cacheId, self :: CACHE_GROUP); |
895 | 895 |
} |
896 | 896 |
} else |
897 |
$projects = $this->_getProjectByCodeId($id, $locale); |
|
897 |
$projects = $this->_getProjectByCodeId($id, $funder, $locale);
|
|
898 | 898 |
return $projects; |
899 | 899 |
} |
900 | 900 |
|
... | ... | |
1073 | 1073 |
$time = microtime(TRUE); |
1074 | 1074 |
$query = self :: PUBLICATION_QUERY; |
1075 | 1075 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1076 |
/* if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_PROJECT . '&query=' . urlencode($query) . '&locale=' . c('-', '_', $locale))) == NULL)
|
|
1076 |
/* if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_PROJECT . '&query=' . urlencode($query) . '&locale=' . c('-', '_', $locale))) == NULL)
|
|
1077 | 1077 |
*/ |
1078 | 1078 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields='. self :: RESULT_COLLECTED_FROM_DATASOURCE.'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
1079 | 1079 |
throw new Exception('no HTTP response'); |
... | ... | |
3156 | 3156 |
// $id the project grant agreement code |
3157 | 3157 |
// $locale the locale to use |
3158 | 3158 |
// return projects or NULL if no such project exists |
3159 |
private function _getProjectByCodeId($id, $locale) { |
|
3159 |
private function _getProjectByCodeId($id, $funder, $locale) {
|
|
3160 | 3160 |
try { |
3161 | 3161 |
$time = microtime(TRUE); |
3162 | 3162 |
$query = self :: PROJECT_QUERY . ' and '; |
3163 | 3163 |
// (oaftype=project) and (projectcode_nt exact 731011) |
3164 |
$query.=' ( projectcode_nt exact "' . $id . '")'; |
|
3165 |
|
|
3164 |
$query.=' ( projectcode_nt exact "' . $id . '") and '; |
|
3165 |
$query.=' ( funderid exact "' . $funder . '")'; |
|
3166 |
//and (funderid exact "ec__________::EC")' |
|
3166 | 3167 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
3167 | 3168 |
if (($response = $this->performGet('search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
3168 | 3169 |
throw new Exception('no HTTP response'); |
Also available in: Unified diff
bug fix for claiming: don't replace '-' to '_' for crossref results -> saving wrong DOIs | use funder id when searching by ga in widget