Search in sources :

Example 6 with MLTextPropertyValue

use of org.alfresco.solr.client.MLTextPropertyValue in project SearchServices by Alfresco.

the class TrieFieldsCMISTest method addTrieTypeTestData.

private void addTrieTypeTestData(NodeRef folder00NodeRef, NodeRef rootNodeRef, NodeRef baseFolderNodeRef, QName baseFolderQName, QName folder00QName, Date date00) throws IOException {
    HashMap<QName, PropertyValue> content00Properties = new HashMap<QName, PropertyValue>();
    MLTextPropertyValue desc00 = new MLTextPropertyValue();
    desc00.addValue(Locale.ENGLISH, "Trie test1");
    content00Properties.put(ContentModel.PROP_DESCRIPTION, desc00);
    content00Properties.put(ContentModel.PROP_TITLE, desc00);
    content00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Trie test1"));
    content00Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date00)));
    StringPropertyValue firstIntValue = new StringPropertyValue("98198");
    content00Properties.put(singleInteger, firstIntValue);
    StringPropertyValue firstLongValue = new StringPropertyValue("3956650");
    content00Properties.put(singleLong, firstLongValue);
    NodeRef content00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName content00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Trie test1");
    ChildAssociationRef content00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content00QName, content00NodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 300, 1, extendedContent, new QName[] { ContentModel.ASPECT_OWNABLE, ContentModel.ASPECT_TITLED }, content00Properties, null, "andy", new ChildAssociationRef[] { content00CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef, folder00NodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() + "/" + content00QName.toString() }, content00NodeRef, true);
    HashMap<QName, PropertyValue> content01Properties = new HashMap<QName, PropertyValue>();
    MLTextPropertyValue desc01 = new MLTextPropertyValue();
    desc01.addValue(Locale.ENGLISH, "Trie test2");
    content01Properties.put(ContentModel.PROP_DESCRIPTION, desc01);
    content01Properties.put(ContentModel.PROP_TITLE, desc01);
    content01Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Trie test2"));
    content01Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date00)));
    StringPropertyValue secondIntValue = new StringPropertyValue("98200");
    content01Properties.put(singleInteger, secondIntValue);
    StringPropertyValue secondLongValue = new StringPropertyValue("3956651");
    content01Properties.put(singleLong, secondLongValue);
    NodeRef content01NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName content01QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Trie test1");
    ChildAssociationRef content01CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content01QName, content01NodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 301, 1, extendedContent, new QName[] { ContentModel.ASPECT_OWNABLE, ContentModel.ASPECT_TITLED }, content01Properties, null, "andy", new ChildAssociationRef[] { content01CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef, folder00NodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() + "/" + content01QName.toString() }, content01NodeRef, true);
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) NodeRef(org.alfresco.service.cmr.repository.NodeRef) StoreRef(org.alfresco.service.cmr.repository.StoreRef) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 7 with MLTextPropertyValue

use of org.alfresco.solr.client.MLTextPropertyValue in project SearchServices by Alfresco.

the class SortCMISTest method addSortableNull.

private void addSortableNull(NodeRef folder00NodeRef, NodeRef rootNodeRef, NodeRef baseFolderNodeRef, Object baseFolderQName, Object folder00QName, Date date1, String id, int offset) throws IOException {
    HashMap<QName, PropertyValue> content00Properties = new HashMap<QName, PropertyValue>();
    MLTextPropertyValue desc00 = new MLTextPropertyValue();
    desc00.addValue(Locale.ENGLISH, "Test null");
    content00Properties.put(ContentModel.PROP_DESCRIPTION, desc00);
    content00Properties.put(ContentModel.PROP_TITLE, desc00);
    content00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Test null"));
    content00Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date1)));
    NodeRef content00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName content00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Test null");
    ChildAssociationRef content00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content00QName, content00NodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 200 + offset, 1, extendedContent, new QName[] { ContentModel.ASPECT_OWNABLE, ContentModel.ASPECT_TITLED }, content00Properties, null, "andy", new ChildAssociationRef[] { content00CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef, folder00NodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() + "/" + content00QName.toString() }, content00NodeRef, true);
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) NodeRef(org.alfresco.service.cmr.repository.NodeRef) StoreRef(org.alfresco.service.cmr.repository.StoreRef) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 8 with MLTextPropertyValue

use of org.alfresco.solr.client.MLTextPropertyValue in project SearchServices by Alfresco.

the class LoadCMISData method addSortableNull.

/**
 * @param folder00NodeRef
 * @param rootNodeRef
 * @param baseFolderNodeRef
 * @param baseFolderQName
 * @param folder00QName
 * @param date1
 * @param id
 * @param offset
 * @throws IOException
 */
private void addSortableNull(NodeRef folder00NodeRef, NodeRef rootNodeRef, NodeRef baseFolderNodeRef, Object baseFolderQName, Object folder00QName, Date date1, String id, int offset) throws IOException {
    HashMap<QName, PropertyValue> content00Properties = new HashMap<QName, PropertyValue>();
    MLTextPropertyValue desc00 = new MLTextPropertyValue();
    desc00.addValue(Locale.ENGLISH, "Test null");
    content00Properties.put(ContentModel.PROP_DESCRIPTION, desc00);
    content00Properties.put(ContentModel.PROP_TITLE, desc00);
    content00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Test null"));
    content00Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date1)));
    NodeRef content00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName content00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Test null");
    ChildAssociationRef content00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content00QName, content00NodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 200 + offset, 1, extendedContent, new QName[] { ContentModel.ASPECT_OWNABLE, ContentModel.ASPECT_TITLED }, content00Properties, null, "andy", new ChildAssociationRef[] { content00CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef, folder00NodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() + "/" + content00QName.toString() }, content00NodeRef, true);
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) NodeRef(org.alfresco.service.cmr.repository.NodeRef) StoreRef(org.alfresco.service.cmr.repository.StoreRef) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef)

Example 9 with MLTextPropertyValue

use of org.alfresco.solr.client.MLTextPropertyValue in project SearchServices by Alfresco.

the class LoadCMISData method makeMLTextMVP.

protected static MultiPropertyValue makeMLTextMVP(int position) {
    MLTextPropertyValue m1 = new MLTextPropertyValue();
    m1.addValue(Locale.ENGLISH, mlOrderable_en[position]);
    MLTextPropertyValue m2 = new MLTextPropertyValue();
    m2.addValue(Locale.FRENCH, mlOrderable_fr[position]);
    MultiPropertyValue answer = new MultiPropertyValue();
    answer.addValue(m1);
    answer.addValue(m2);
    return answer;
}
Also used : MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue)

Example 10 with MLTextPropertyValue

use of org.alfresco.solr.client.MLTextPropertyValue in project SearchServices by Alfresco.

the class LoadCMISData method addSortableNode.

protected void addSortableNode(NodeRef folder00NodeRef, NodeRef rootNodeRef, NodeRef baseFolderNodeRef, Object baseFolderQName, Object folder00QName, Date date1, int position) throws IOException {
    HashMap<QName, PropertyValue> content00Properties = new HashMap<QName, PropertyValue>();
    MLTextPropertyValue desc00 = new MLTextPropertyValue();
    desc00.addValue(Locale.ENGLISH, "Test " + position);
    content00Properties.put(ContentModel.PROP_DESCRIPTION, desc00);
    content00Properties.put(ContentModel.PROP_TITLE, desc00);
    content00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Test " + position));
    content00Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date1)));
    StringPropertyValue single = new StringPropertyValue(orderable[position]);
    content00Properties.put(singleTextUntokenised, single);
    content00Properties.put(singleTextTokenised, single);
    content00Properties.put(singleTextBoth, single);
    MultiPropertyValue multi = new MultiPropertyValue();
    multi.addValue(single);
    multi.addValue(new StringPropertyValue(orderable[position + 1]));
    content00Properties.put(multipleTextUntokenised, multi);
    content00Properties.put(multipleTextTokenised, multi);
    content00Properties.put(multipleTextBoth, multi);
    content00Properties.put(singleMLTextUntokenised, makeMLText(position));
    content00Properties.put(singleMLTextTokenised, makeMLText(position));
    content00Properties.put(singleMLTextBoth, makeMLText(position));
    content00Properties.put(multipleMLTextUntokenised, makeMLTextMVP(position));
    content00Properties.put(multipleMLTextTokenised, makeMLTextMVP(position));
    content00Properties.put(multipleMLTextBoth, makeMLTextMVP());
    StringPropertyValue one = new StringPropertyValue("" + (1.1 * position));
    StringPropertyValue two = new StringPropertyValue("" + (2.2 * position));
    MultiPropertyValue multiDec = new MultiPropertyValue();
    multiDec.addValue(one);
    multiDec.addValue(two);
    content00Properties.put(singleFloat, one);
    content00Properties.put(multipleFloat, multiDec);
    content00Properties.put(singleDouble, one);
    content00Properties.put(multipleDouble, multiDec);
    one = new StringPropertyValue("" + (1 * position));
    two = new StringPropertyValue("" + (2 * position));
    MultiPropertyValue multiInt = new MultiPropertyValue();
    multiInt.addValue(one);
    multiInt.addValue(two);
    content00Properties.put(singleInteger, one);
    content00Properties.put(multipleInteger, multiInt);
    content00Properties.put(singleLong, one);
    content00Properties.put(multipleLong, multiInt);
    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(date1);
    cal.add(Calendar.DAY_OF_MONTH, position);
    Date newdate1 = cal.getTime();
    cal.add(Calendar.DAY_OF_MONTH, -1);
    cal.add(Calendar.DAY_OF_MONTH, 2);
    Date date2 = cal.getTime();
    StringPropertyValue d1 = new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, newdate1));
    StringPropertyValue d2 = new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date2));
    MultiPropertyValue multiDate = new MultiPropertyValue();
    multiDate.addValue(d1);
    multiDate.addValue(d2);
    content00Properties.put(singleDate, d1);
    content00Properties.put(multipleDate, multiDate);
    content00Properties.put(singleDatetime, d1);
    content00Properties.put(multipleDatetime, multiDate);
    StringPropertyValue b = new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, position % 2 == 0 ? true : false));
    StringPropertyValue bTrue = new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, true));
    StringPropertyValue bFalse = new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, false));
    MultiPropertyValue multiBool = new MultiPropertyValue();
    multiBool.addValue(bTrue);
    multiBool.addValue(bFalse);
    content00Properties.put(singleBoolean, b);
    content00Properties.put(multipleBoolean, multiBool);
    NodeRef content00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
    QName content00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Test " + position);
    ChildAssociationRef content00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content00QName, content00NodeRef, true, 0);
    addNode(h.getCore(), dataModel, 1, 1000 + position, 1, extendedContent, new QName[] { ContentModel.ASPECT_OWNABLE, ContentModel.ASPECT_TITLED }, content00Properties, null, "andy", new ChildAssociationRef[] { content00CAR }, new NodeRef[] { baseFolderNodeRef, rootNodeRef, folder00NodeRef }, new String[] { "/" + baseFolderQName.toString() + "/" + folder00QName.toString() + "/" + content00QName.toString() }, content00NodeRef, true);
}
Also used : StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) StoreRef(org.alfresco.service.cmr.repository.StoreRef) HashMap(java.util.HashMap) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) QName(org.alfresco.service.namespace.QName) GregorianCalendar(java.util.GregorianCalendar) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue) MultiPropertyValue(org.alfresco.solr.client.MultiPropertyValue) PropertyValue(org.alfresco.solr.client.PropertyValue) StringPropertyValue(org.alfresco.solr.client.StringPropertyValue) ContentPropertyValue(org.alfresco.solr.client.ContentPropertyValue) ChildAssociationRef(org.alfresco.service.cmr.repository.ChildAssociationRef) Date(java.util.Date) NodeRef(org.alfresco.service.cmr.repository.NodeRef) MLTextPropertyValue(org.alfresco.solr.client.MLTextPropertyValue)

Aggregations

MLTextPropertyValue (org.alfresco.solr.client.MLTextPropertyValue)12 QName (org.alfresco.service.namespace.QName)10 PropertyValue (org.alfresco.solr.client.PropertyValue)10 StringPropertyValue (org.alfresco.solr.client.StringPropertyValue)10 HashMap (java.util.HashMap)8 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)8 NodeRef (org.alfresco.service.cmr.repository.NodeRef)8 StoreRef (org.alfresco.service.cmr.repository.StoreRef)8 ContentPropertyValue (org.alfresco.solr.client.ContentPropertyValue)8 MultiPropertyValue (org.alfresco.solr.client.MultiPropertyValue)8 Date (java.util.Date)5 GregorianCalendar (java.util.GregorianCalendar)3 BeforeClass (org.junit.BeforeClass)3 Locale (java.util.Locale)2 AlfrescoSolrDataModel (org.alfresco.solr.AlfrescoSolrDataModel)2 SolrCore (org.apache.solr.core.SolrCore)2 Calendar (java.util.Calendar)1 Period (org.alfresco.service.cmr.repository.Period)1 Duration (org.alfresco.service.cmr.repository.datatype.Duration)1 FieldInstance (org.alfresco.solr.AlfrescoSolrDataModel.FieldInstance)1