ALF-9413: RSOLR 022: Fine-grained control of full-text indexing

- final part - supported in SOLR, added aspect support to explorer and share

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29192 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-07-19 15:02:21 +00:00
parent 663760cd08
commit ca67fe0aff
3 changed files with 145 additions and 101 deletions

View File

@@ -327,3 +327,9 @@ cm_contentmodel.property.exif_yResolution.description=Vertical resolution in pix
cm_contentmodel.property.exif_resolutionUnit.title=Resolution Unit
cm_contentmodel.property.exif_resolutionUnit.description=Unit used for horizontal and vertical resolution
cm_contentmodel.aspect.cm_indexControl.title=Index Control
cm_contentmodel.aspect.cm_indexControl.description=Control Index Behaviour
cm_contentmodel.property.cm_isIndexed.title=Is Indexed
cm_contentmodel.property.cm_isIndexed.description=Is the node indexed and can be found via search.
cm_contentmodel.property.cm_isContentIndexed.title=Is Content Indexed
cm_contentmodel.property.cm_isContentIndexed.description=Are the node's d:content properties indexed?

View File

@@ -1419,10 +1419,12 @@
<property name="cm:isIndexed">
<title>Is indexed</title>
<type>d:boolean</type>
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<title>Is content indexed</title>
<type>d:boolean</type>
<default>true</default>
</property>
</properties>
</aspect>

View File

@@ -476,16 +476,44 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
boolean isAtomic = true;
Map<QName, Serializable> properties = getIndexableProperties(desc, nodeRef, endVersion, stringNodeRef);
if(properties.containsKey(ContentModel.PROP_IS_INDEXED))
{
Serializable sValue = properties.get(ContentModel.PROP_IS_INDEXED);
if(sValue != null)
{
Boolean isIndexed = DefaultTypeConverter.INSTANCE.convert(Boolean.class, sValue);
if((isIndexed != null) && (isIndexed.booleanValue() == false))
{
return docs;
}
}
}
boolean isContentIndexedForNode = true;
if(properties.containsKey(ContentModel.PROP_IS_CONTENT_INDEXED))
{
Serializable sValue = properties.get(ContentModel.PROP_IS_CONTENT_INDEXED);
if(sValue != null)
{
Boolean isIndexed = DefaultTypeConverter.INSTANCE.convert(Boolean.class, sValue);
if((isIndexed != null) && (isIndexed.booleanValue() == false))
{
isContentIndexedForNode = false;
}
}
}
for (QName propertyName : properties.keySet())
{
Serializable value = properties.get(propertyName);
if (indexAllProperties)
{
indexProperty(nodeRef, propertyName, value, xdoc, false, properties);
indexProperty(nodeRef, propertyName, value, xdoc, false, properties, isContentIndexedForNode);
}
else
{
isAtomic &= indexProperty(nodeRef, propertyName, value, xdoc, true, properties);
isAtomic &= indexProperty(nodeRef, propertyName, value, xdoc, true, properties,isContentIndexedForNode);
}
}
@@ -722,7 +750,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
}
}
protected boolean indexProperty(NodeRef banana, QName propertyName, Serializable value, Document doc, boolean indexAtomicPropertiesOnly, Map<QName, Serializable> properties)
protected boolean indexProperty(NodeRef banana, QName propertyName, Serializable value, Document doc, boolean indexAtomicPropertiesOnly, Map<QName, Serializable> properties, boolean isContentIndexedForNode)
{
String attributeName = "@" + QName.createQName(propertyName.getNamespaceURI(), ISO9075.encode(propertyName.getLocalName()));
@@ -811,6 +839,9 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
}
doc.add(new Field(attributeName + ".locale", locale.toString().toLowerCase(), Field.Store.NO, Field.Index.UN_TOKENIZED, Field.TermVector.NO));
if(isContentIndexedForNode)
{
ContentReader reader = null;
try
{
@@ -927,6 +958,11 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
}
}
else
{
return true;
}
}
else
{
Field.Store fieldStore = store ? Field.Store.YES : Field.Store.NO;
Field.Index fieldIndex;