mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Search API updates. FTS fixes for range and dual tokenisation.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14419 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,11 +31,15 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Common support for a row in a result set
|
||||
*
|
||||
* @author andyh
|
||||
*/
|
||||
public abstract class AbstractResultSetRow implements ResultSetRow
|
||||
{
|
||||
|
||||
@@ -50,12 +54,17 @@ public abstract class AbstractResultSetRow implements ResultSetRow
|
||||
private int index;
|
||||
|
||||
/**
|
||||
* The direct properties of the current node
|
||||
* Used by those implementations that can cache the whole set.
|
||||
* The direct properties of the current node Used by those implementations that can cache the whole set.
|
||||
*/
|
||||
|
||||
private Map<Path, Serializable> properties;
|
||||
protected Map<String, Serializable> properties;
|
||||
|
||||
/**
|
||||
* The row needs the result set and the index for lookup.
|
||||
*
|
||||
* @param resultSet
|
||||
* @param index
|
||||
*/
|
||||
public AbstractResultSetRow(ResultSet resultSet, int index)
|
||||
{
|
||||
super();
|
||||
@@ -82,55 +91,49 @@ public abstract class AbstractResultSetRow implements ResultSetRow
|
||||
{
|
||||
return getResultSet().getChildAssocRef(getIndex()).getQName();
|
||||
}
|
||||
|
||||
|
||||
public ChildAssociationRef getChildAssocRef()
|
||||
{
|
||||
return getResultSet().getChildAssocRef(getIndex());
|
||||
}
|
||||
|
||||
|
||||
public float getScore()
|
||||
{
|
||||
return getResultSet().getScore(getIndex());
|
||||
}
|
||||
|
||||
public Map<Path, Serializable> getValues()
|
||||
public Map<String, Serializable> getValues()
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new HashMap<Path, Serializable>();
|
||||
properties = new HashMap<String, Serializable>();
|
||||
setProperties(getDirectProperties());
|
||||
}
|
||||
return Collections.unmodifiableMap(properties);
|
||||
}
|
||||
|
||||
public Serializable getValue(Path path)
|
||||
public Serializable getValue(String columnName)
|
||||
{
|
||||
return properties.get(path);
|
||||
return properties.get(columnName);
|
||||
}
|
||||
|
||||
|
||||
protected Map<QName, Serializable> getDirectProperties()
|
||||
{
|
||||
return Collections.<QName, Serializable>emptyMap();
|
||||
return Collections.<QName, Serializable> emptyMap();
|
||||
}
|
||||
|
||||
|
||||
protected void setProperties(Map<QName, Serializable> byQname)
|
||||
{
|
||||
for (QName qname : byQname.keySet())
|
||||
{
|
||||
Serializable value = byQname.get(qname);
|
||||
Path path = new Path();
|
||||
path.append(new Path.SelfElement());
|
||||
path.append(new Path.AttributeElement(qname));
|
||||
properties.put(path, value);
|
||||
properties.put(qname.toString(), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Serializable getValue(QName qname)
|
||||
{
|
||||
Path path = new Path();
|
||||
path.append(new Path.SelfElement());
|
||||
path.append(new Path.AttributeElement(qname));
|
||||
return getValues().get(path);
|
||||
return getValues().get(qname.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user