NIHVIVO-1926 code change in getSearchBoost method to retrieve float value.
This commit is contained in:
parent
d286816a2c
commit
6b6bd1194a
1 changed files with 17 additions and 4 deletions
|
@ -669,17 +669,29 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
String getPropertyValue =
|
String getPropertyValue =
|
||||||
"SELECT ?value \n" +
|
"SELECT ?value \n" +
|
||||||
"WHERE { GRAPH ?g { \n" +
|
"WHERE { GRAPH ?g { \n" +
|
||||||
"<" +individualURI+ "> <" +webappDaoFactory.getJenaBaseDao().SEARCH_BOOST_ANNOT+ "> ?value} \n" +
|
"<" +individualURI+ "> <" +webappDaoFactory.getJenaBaseDao().SEARCH_BOOST_ANNOT+ "> ?value }\n" +
|
||||||
WebappDaoFactorySDB.getFilterBlock(graphVars, datasetMode) + "\n" +
|
WebappDaoFactorySDB.getFilterBlock(graphVars, datasetMode) + "\n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
DatasetWrapper w = getDatasetWrapper();
|
DatasetWrapper w = getDatasetWrapper();
|
||||||
Dataset dataset = w.getDataset();
|
Dataset dataset = w.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
try{
|
try{
|
||||||
searchBoost = ((Literal)QueryExecutionFactory.create(
|
ResultSet rs = QueryExecutionFactory.create(
|
||||||
QueryFactory.create(getPropertyValue),
|
QueryFactory.create(getPropertyValue),
|
||||||
dataset).execSelect()).getFloat();
|
dataset).execSelect();
|
||||||
return searchBoost;
|
|
||||||
|
if(rs.hasNext()){
|
||||||
|
QuerySolution qs = rs.nextSolution();
|
||||||
|
if(qs.get("value") !=null){
|
||||||
|
Literal value = qs.get("value").asLiteral();
|
||||||
|
searchBoost = Float.parseFloat(value.getLexicalForm());
|
||||||
|
return searchBoost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.error(e,e);
|
log.error(e,e);
|
||||||
return null;
|
return null;
|
||||||
|
@ -688,6 +700,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue