Better indexing for string properties to support path-based lookups

- Normal prefix-index has been shortened to 32 chars (from 64)
 - Added a fully indexed 'string_end' column of 16 characters
 - iBatis queries are optimized to pull short strings from the index
 - Long paths and NodeRefs are well-indexed using this approach


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15833 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-08-20 13:03:29 +00:00
parent f1e5670836
commit 33cb2a4d75
5 changed files with 91 additions and 41 deletions

View File

@@ -423,18 +423,6 @@ public abstract class AbstractPropertyValueDAOImpl implements PropertyValueDAO
*/
private class PropertyStringValueCallbackDAO extends EntityLookupCallbackDAOAdaptor<Long, String, Pair<String, Long>>
{
private final Pair<Long, String> convertEntityToPair(PropertyStringValueEntity entity)
{
if (entity == null)
{
return null;
}
else
{
return entity.getEntityPair();
}
}
public Pair<String, Long> getValueKey(String value)
{
return CrcHelper.getStringCrcPair(value, 128, true, true);
@@ -442,26 +430,40 @@ public abstract class AbstractPropertyValueDAOImpl implements PropertyValueDAO
public Pair<Long, String> createValue(String value)
{
PropertyStringValueEntity entity = createStringValue(value);
return convertEntityToPair(entity);
Long key = createStringValue(value);
return new Pair<Long, String>(key, value);
}
public Pair<Long, String> findByKey(Long key)
{
PropertyStringValueEntity entity = findStringValueById(key);
return convertEntityToPair(entity);
String value = findStringValueById(key);
if (value == null)
{
return null;
}
else
{
return new Pair<Long, String>(key, value);
}
}
public Pair<Long, String> findByValue(String value)
{
PropertyStringValueEntity entity = findStringValueByValue(value);
return convertEntityToPair(entity);
Long key = findStringValueByValue(value);
if (key == null)
{
return null;
}
else
{
return new Pair<Long, String>(key, value);
}
}
}
protected abstract PropertyStringValueEntity findStringValueById(Long id);
protected abstract PropertyStringValueEntity findStringValueByValue(String value);
protected abstract PropertyStringValueEntity createStringValue(String value);
protected abstract String findStringValueById(Long id);
protected abstract Long findStringValueByValue(String value);
protected abstract Long createStringValue(String value);
//================================
// 'alf_prop_double_value' accessors