}
public MultiValueMap getRelationsInformation(String type,
String from, String to) throws SearchServiceException
{
MultiValueMap result = new MultiValueMap();
SolrQuery solrQuery = new SolrQuery();
Matcher matcher = patternRP.matcher(from);
String field1 = "";
String field2 = "";
if (matcher.find())
{
field1 = "focus_auth";
}
else
{
field1 = "focus_val";
}
matcher = patternRP.matcher(to);
if (matcher.find())
{
field2 = "focus_auth";
}
else
{
field2 = "focus_val";
}
solrQuery.setQuery(field1 + ":\"" + from
+ "\" AND " + field2 + ":\"" + to + "\"");
solrQuery.addFilterQuery("type:" + type);
solrQuery.setRows(Integer.MAX_VALUE);
QueryResponse rsp = service.search(solrQuery);
for (SolrDocument doc : rsp.getResults())
{
String resultField = "";
if (doc.getFieldValue("value") instanceof String)
{
resultField = (String) doc.getFieldValue("value");
}
else
{
for (String ss : (List<String>) doc.getFieldValue("value"))
{
resultField += ss;
}
}
String resultFieldExtra = "";
if (doc.getFieldValue("extra")!=null)
{
if (doc.getFieldValue("extra") instanceof String)
{
resultFieldExtra = (String) doc.getFieldValue("extra");
}
else
{
for (String ss : (List<String>) doc.getFieldValue("extra"))
{
resultFieldExtra += ss;
}
}
}
result.put(resultField, resultFieldExtra);
}
return result;
}