use of org.alfresco.solr.client.MultiPropertyValue in project SearchServices by Alfresco.
the class LoadAFTSTestData method loadTestSet.
@BeforeClass
public static void loadTestSet() throws Exception {
initAlfrescoCore("schema.xml");
Thread.sleep(1000);
// Root
SolrCore core = h.getCore();
AlfrescoSolrDataModel dataModel = AlfrescoSolrDataModel.getInstance();
dataModel.getNamespaceDAO().removePrefix("");
dataModel.setCMDefaultUri();
rootNodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
addStoreRoot(core, dataModel, rootNodeRef, 1, 1, 1, 1);
// 1
n01NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n01QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "one");
n01CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n01QName, n01NodeRef, true, 0);
addNode(core, dataModel, 1, 2, 1, testSuperType, null, getOrderProperties(), null, "andy", new ChildAssociationRef[] { n01CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n01QName.toString() }, n01NodeRef, true);
testNodeRef = n01NodeRef;
// 2
n02NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n02QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "two");
n02CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n02QName, n02NodeRef, true, 0);
addNode(core, dataModel, 1, 3, 1, testSuperType, null, getOrderProperties(), null, "bob", new ChildAssociationRef[] { n02CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n02QName.toString() }, n02NodeRef, true);
// 3
n03NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n03QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "three");
n03CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n03QName, n03NodeRef, true, 0);
addNode(core, dataModel, 1, 4, 1, testSuperType, null, getOrderProperties(), null, "cid", new ChildAssociationRef[] { n03CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n03QName.toString() }, n03NodeRef, true);
// 4
properties04 = new HashMap<QName, PropertyValue>();
content04 = new HashMap<QName, String>();
properties04.putAll(getOrderProperties());
properties04.put(QName.createQName(TEST_NAMESPACE, "text-indexed-stored-tokenised-atomic"), new StringPropertyValue("TEXT THAT IS INDEXED STORED AND TOKENISED ATOMICALLY KEYONE"));
properties04.put(QName.createQName(TEST_NAMESPACE, "text-indexed-unstored-tokenised-atomic"), new StringPropertyValue("TEXT THAT IS INDEXED STORED AND TOKENISED ATOMICALLY KEYUNSTORED"));
properties04.put(QName.createQName(TEST_NAMESPACE, "text-indexed-stored-tokenised-nonatomic"), new StringPropertyValue("TEXT THAT IS INDEXED STORED AND TOKENISED BUT NOT ATOMICALLY KEYTWO"));
properties04.put(QName.createQName(TEST_NAMESPACE, "int-ista"), new StringPropertyValue("1"));
properties04.put(QName.createQName(TEST_NAMESPACE, "long-ista"), new StringPropertyValue("2"));
properties04.put(QName.createQName(TEST_NAMESPACE, "float-ista"), new StringPropertyValue("3.4"));
properties04.put(QName.createQName(TEST_NAMESPACE, "double-ista"), new StringPropertyValue("5.6"));
Calendar c = new GregorianCalendar();
c.setTime(new Date(((new Date().getTime() - 10000))));
Date testDate = c.getTime();
ftsTestDate = testDate;
properties04.put(QName.createQName(TEST_NAMESPACE, "date-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, testDate)));
properties04.put(QName.createQName(TEST_NAMESPACE, "datetime-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, testDate)));
properties04.put(QName.createQName(TEST_NAMESPACE, "boolean-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, Boolean.valueOf(true))));
properties04.put(QName.createQName(TEST_NAMESPACE, "qname-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, QName.createQName("{wibble}wobble"))));
properties04.put(QName.createQName(TEST_NAMESPACE, "category-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, new NodeRef(new StoreRef("proto", "id"), "CategoryId"))));
properties04.put(QName.createQName(TEST_NAMESPACE, "noderef-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, n01NodeRef)));
properties04.put(QName.createQName(TEST_NAMESPACE, "path-ista"), new StringPropertyValue("/" + n03QName.toString()));
properties04.put(QName.createQName(TEST_NAMESPACE, "locale-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, Locale.UK)));
properties04.put(QName.createQName(TEST_NAMESPACE, "period-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, new Period("period|12"))));
properties04.put(QName.createQName(TEST_NAMESPACE, "null"), null);
MultiPropertyValue list_0 = new MultiPropertyValue();
list_0.addValue(new StringPropertyValue("one"));
list_0.addValue(new StringPropertyValue("two"));
properties04.put(QName.createQName(TEST_NAMESPACE, "list"), list_0);
MLTextPropertyValue mlText = new MLTextPropertyValue();
mlText.addValue(Locale.ENGLISH, "banana");
mlText.addValue(Locale.FRENCH, "banane");
mlText.addValue(Locale.CHINESE, "香蕉");
mlText.addValue(new Locale("nl"), "banaan");
mlText.addValue(Locale.GERMAN, "banane");
mlText.addValue(new Locale("el"), "μπανάνα");
mlText.addValue(Locale.ITALIAN, "banana");
mlText.addValue(new Locale("ja"), "バナナ");
mlText.addValue(new Locale("ko"), "바나나");
mlText.addValue(new Locale("pt"), "banana");
mlText.addValue(new Locale("ru"), "банан");
mlText.addValue(new Locale("es"), "plátano");
properties04.put(QName.createQName(TEST_NAMESPACE, "ml"), mlText);
MultiPropertyValue list_1 = new MultiPropertyValue();
list_1.addValue(new StringPropertyValue("100"));
list_1.addValue(new StringPropertyValue("anyValueAsString"));
properties04.put(QName.createQName(TEST_NAMESPACE, "any-many-ista"), list_1);
MultiPropertyValue list_2 = new MultiPropertyValue();
list_2.addValue(new ContentPropertyValue(Locale.ENGLISH, 12L, "UTF-16", "text/plain", null));
properties04.put(QName.createQName(TEST_NAMESPACE, "content-many-ista"), list_2);
content04.put(QName.createQName(TEST_NAMESPACE, "content-many-ista"), "multicontent");
MLTextPropertyValue mlText1 = new MLTextPropertyValue();
mlText1.addValue(Locale.ENGLISH, "cabbage");
mlText1.addValue(Locale.FRENCH, "chou");
MLTextPropertyValue mlText2 = new MLTextPropertyValue();
mlText2.addValue(Locale.ENGLISH, "lemur");
mlText2.addValue(new Locale("ru"), "лемур");
MultiPropertyValue list_3 = new MultiPropertyValue();
list_3.addValue(mlText1);
list_3.addValue(mlText2);
properties04.put(QName.createQName(TEST_NAMESPACE, "mltext-many-ista"), list_3);
MultiPropertyValue list_4 = new MultiPropertyValue();
list_4.addValue(null);
properties04.put(QName.createQName(TEST_NAMESPACE, "nullist"), list_4);
n04NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n04QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "four");
n04CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n04QName, n04NodeRef, true, 0);
properties04.put(QName.createQName(TEST_NAMESPACE, "aspectProperty"), new StringPropertyValue(""));
addNode(core, dataModel, 1, 5, 1, testType, new QName[] { testAspect }, properties04, content04, "dave", new ChildAssociationRef[] { n04CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n04QName.toString() }, n04NodeRef, true);
// 5
n05NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n05QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "five");
n05CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n05QName, n05NodeRef, true, 0);
addNode(core, dataModel, 1, 6, 1, testSuperType, null, getOrderProperties(), null, "eoin", new ChildAssociationRef[] { n05CAR }, new NodeRef[] { rootNodeRef, n01NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() }, n05NodeRef, true);
// 6
n06NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n06QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "six");
n06CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n06QName, n06NodeRef, true, 0);
addNode(core, dataModel, 1, 7, 1, testSuperType, null, getOrderProperties(), null, "fred", new ChildAssociationRef[] { n06CAR }, new NodeRef[] { rootNodeRef, n01NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n06QName.toString() }, n06NodeRef, true);
// 7
n07NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n07QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "seven");
n07CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n07QName, n07NodeRef, true, 0);
addNode(core, dataModel, 1, 8, 1, testSuperType, null, getOrderProperties(), null, "gail", new ChildAssociationRef[] { n07CAR }, new NodeRef[] { rootNodeRef, n02NodeRef }, new String[] { "/" + n02QName.toString() + "/" + n07QName.toString() }, n07NodeRef, true);
// 8
n08NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n08QName_0 = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eight-0");
n08QName_1 = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eight-1");
n08QName_2 = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eight-2");
n08CAR_0 = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n08QName_0, n08NodeRef, false, 2);
n08CAR_1 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n08QName_1, n08NodeRef, false, 1);
n08CAR_2 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n08QName_2, n08NodeRef, true, 0);
addNode(core, dataModel, 1, 9, 1, testSuperType, null, getOrderProperties(), null, "hal", new ChildAssociationRef[] { n08CAR_0, n08CAR_1, n08CAR_2 }, new NodeRef[] { rootNodeRef, rootNodeRef, n01NodeRef, rootNodeRef, n02NodeRef }, new String[] { "/" + n08QName_0, "/" + n01QName.toString() + "/" + n08QName_1.toString(), "/" + n02QName.toString() + "/" + n08QName_2.toString() }, n08NodeRef, true);
// 9
n09NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n09QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "nine");
n09CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n09QName, n09NodeRef, true, 0);
addNode(core, dataModel, 1, 10, 1, testSuperType, null, getOrderProperties(), null, "ian", new ChildAssociationRef[] { n09CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n09QName }, n09NodeRef, true);
// 10
n10NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n10QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "ten");
n10CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n10QName, n10NodeRef, true, 0);
addNode(core, dataModel, 1, 11, 1, testSuperType, null, getOrderProperties(), null, "jake", new ChildAssociationRef[] { n10CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n10QName }, n10NodeRef, true);
// 11
n11NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n11QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eleven");
n11CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n11QName, n11NodeRef, true, 0);
addNode(core, dataModel, 1, 12, 1, testSuperType, null, getOrderProperties(), null, "kara", new ChildAssociationRef[] { n11CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n11QName }, n11NodeRef, true);
// 12
n12NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n12QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twelve");
n12CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n12QName, n12NodeRef, true, 0);
addNode(core, dataModel, 1, 13, 1, testSuperType, null, getOrderProperties(), null, "loon", new ChildAssociationRef[] { n12CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName }, n12NodeRef, true);
// 13
n13NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n13QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "thirteen");
n13QNameLink = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "link");
n13CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n12NodeRef, n13QName, n13NodeRef, true, 0);
n13CARLink = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n13QName, n13NodeRef, false, 0);
addNode(core, dataModel, 1, 14, 1, testSuperType, null, getOrderProperties(), null, "mike", new ChildAssociationRef[] { n13CAR, n13CARLink }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef, n12NodeRef, rootNodeRef, n02NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName + "/" + n13QName, "/" + n02QName.toString() + "/" + n13QNameLink }, n13NodeRef, true);
// 14
properties14 = new HashMap<QName, PropertyValue>();
properties14.putAll(getOrderProperties());
content14 = new HashMap<QName, String>();
MLTextPropertyValue desc1 = new MLTextPropertyValue();
desc1.addValue(Locale.ENGLISH, "Alfresco tutorial");
desc1.addValue(Locale.US, "Alfresco tutorial");
Date explicitCreatedDate = new Date();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
properties14.put(ContentModel.PROP_CONTENT, new ContentPropertyValue(Locale.UK, 298L, "UTF-8", "text/plain", null));
content14.put(ContentModel.PROP_CONTENT, "The quick brown fox jumped over the lazy dog and ate the Alfresco Tutorial, in pdf format, along with the following stop words; a an and are" + " as at be but by for if in into is it no not of on or such that the their then there these they this to was will with: " + " and random charcters \u00E0\u00EA\u00EE\u00F0\u00F1\u00F6\u00FB\u00FF");
properties14.put(ContentModel.PROP_DESCRIPTION, desc1);
properties14.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, explicitCreatedDate)));
properties14.put(ContentModel.PROP_MODIFIED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, explicitCreatedDate)));
MLTextPropertyValue title = new MLTextPropertyValue();
title.addValue(Locale.ENGLISH, "English123");
title.addValue(Locale.FRENCH, "French123");
properties14.put(ContentModel.PROP_TITLE, title);
n14NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n14QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "fourteen");
n14QNameCommon = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "common");
n14CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n13NodeRef, n14QName, n14NodeRef, true, 0);
n14CAR_1 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_2 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_5 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_6 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n06NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_12 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n12NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_13 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n13NodeRef, n14QNameCommon, n14NodeRef, false, 0);
addNode(core, dataModel, 1, 15, 1, ContentModel.TYPE_CONTENT, new QName[] { ContentModel.ASPECT_TITLED }, properties14, content14, "noodle", new ChildAssociationRef[] { n14CAR, n14CAR_1, n14CAR_2, n14CAR_5, n14CAR_6, n14CAR_12, n14CAR_13 }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef, n12NodeRef, n13NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName + "/" + n13QName + "/" + n14QName, "/" + n02QName.toString() + "/" + n13QNameLink + "/" + n14QName, "/" + n01QName + "/" + n14QNameCommon, "/" + n02QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n05QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n06QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n05QName + "/" + n12QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n05QName + "/" + n12QName + "/" + n13QName + "/" + n14QNameCommon }, n14NodeRef, true);
// 15
properties15 = new HashMap<QName, PropertyValue>();
properties15.putAll(getOrderProperties());
properties15.put(ContentModel.PROP_MODIFIED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, explicitCreatedDate)));
content15 = new HashMap<QName, String>();
content15.put(ContentModel.PROP_CONTENT, " ");
n15NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n15QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "fifteen");
n15CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n13NodeRef, n15QName, n15NodeRef, true, 0);
addNode(core, dataModel, 1, 16, 1, ContentModel.TYPE_THUMBNAIL, null, properties15, content15, "ood", new ChildAssociationRef[] { n15CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef, n12NodeRef, n13NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName + "/" + n13QName + "/" + n15QName, "/" + n02QName.toString() + "/" + n13QNameLink + "/" + n14QName }, n15NodeRef, true);
}
use of org.alfresco.solr.client.MultiPropertyValue in project SearchServices by Alfresco.
the class LoadCMISData method addTypeTestData.
protected static void addTypeTestData(NodeRef folder00NodeRef, NodeRef rootNodeRef, NodeRef baseFolderNodeRef, Object baseFolderQName, Object folder00QName, Date date1) throws IOException {
HashMap<QName, PropertyValue> content00Properties = new HashMap<QName, PropertyValue>();
MLTextPropertyValue desc00 = new MLTextPropertyValue();
desc00.addValue(Locale.ENGLISH, "Test One");
desc00.addValue(Locale.US, "Test 1");
content00Properties.put(ContentModel.PROP_DESCRIPTION, desc00);
content00Properties.put(ContentModel.PROP_TITLE, desc00);
content00Properties.put(ContentModel.PROP_NAME, new StringPropertyValue("Test One"));
content00Properties.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date1)));
StringPropertyValue single = new StringPropertyValue("Un tokenised");
content00Properties.put(singleTextUntokenised, single);
content00Properties.put(singleTextTokenised, single);
content00Properties.put(singleTextBoth, single);
MultiPropertyValue multi = new MultiPropertyValue();
multi.addValue(single);
multi.addValue(new StringPropertyValue("two parts"));
content00Properties.put(multipleTextUntokenised, multi);
content00Properties.put(multipleTextTokenised, multi);
content00Properties.put(multipleTextBoth, multi);
content00Properties.put(singleMLTextUntokenised, makeMLText());
content00Properties.put(singleMLTextTokenised, makeMLText());
content00Properties.put(singleMLTextBoth, makeMLText());
content00Properties.put(multipleMLTextUntokenised, makeMLTextMVP());
content00Properties.put(multipleMLTextTokenised, makeMLTextMVP());
content00Properties.put(multipleMLTextBoth, makeMLTextMVP());
StringPropertyValue one = new StringPropertyValue("1");
StringPropertyValue two = new StringPropertyValue("2");
MultiPropertyValue multiDec = new MultiPropertyValue();
multiDec.addValue(one);
multiDec.addValue(new StringPropertyValue("1.1"));
content00Properties.put(singleFloat, one);
content00Properties.put(multipleFloat, multiDec);
content00Properties.put(singleDouble, one);
content00Properties.put(multipleDouble, multiDec);
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, -1);
cal.add(Calendar.DAY_OF_MONTH, 2);
Date date2 = cal.getTime();
StringPropertyValue d1 = new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, date1));
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 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, bTrue);
content00Properties.put(multipleBoolean, multiBool);
NodeRef content00NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
QName content00QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "Test One");
ChildAssociationRef content00CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, folder00NodeRef, content00QName, content00NodeRef, true, 0);
addNode(h.getCore(), dataModel, 1, 100, 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);
}
use of org.alfresco.solr.client.MultiPropertyValue 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;
}
use of org.alfresco.solr.client.MultiPropertyValue 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);
}
use of org.alfresco.solr.client.MultiPropertyValue in project SearchServices by Alfresco.
the class SolrInformationServer method addPropertiesToDoc.
static void addPropertiesToDoc(Map<QName, PropertyValue> properties, boolean isContentIndexedForNode, SolrInputDocument newDoc, SolrInputDocument cachedDoc, boolean transformContentFlag) throws IOException {
for (QName propertyQName : properties.keySet()) {
newDoc.addField(FIELD_PROPERTIES, propertyQName.toString());
newDoc.addField(FIELD_PROPERTIES, propertyQName.getPrefixString());
PropertyValue value = properties.get(propertyQName);
// System.out.println("####### indexing prop:"+propertyQName.toString()+":"+value.toString());
if (value != null) {
if (value instanceof StringPropertyValue) {
for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
// System.out.println("####### field:"+field.getField()+":"+value.toString());
addStringPropertyToDoc(newDoc, field, (StringPropertyValue) value, properties);
}
} else if (value instanceof MLTextPropertyValue) {
for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
addMLTextPropertyToDoc(newDoc, field, (MLTextPropertyValue) value);
}
} else if (value instanceof ContentPropertyValue) {
boolean transform = transformContentFlag;
if (!isContentIndexedForNode) {
transform = false;
}
addContentPropertyToDocUsingCache(newDoc, cachedDoc, propertyQName, (ContentPropertyValue) value, transform);
} else if (value instanceof MultiPropertyValue) {
MultiPropertyValue typedValue = (MultiPropertyValue) value;
for (PropertyValue singleValue : typedValue.getValues()) {
if (singleValue instanceof StringPropertyValue) {
for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
addStringPropertyToDoc(newDoc, field, (StringPropertyValue) singleValue, properties);
}
} else if (singleValue instanceof MLTextPropertyValue) {
for (FieldInstance field : AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(propertyQName).getFields()) {
addMLTextPropertyToDoc(newDoc, field, (MLTextPropertyValue) singleValue);
}
} else if (singleValue instanceof ContentPropertyValue) {
boolean transform = transformContentFlag;
if (!isContentIndexedForNode) {
transform = false;
}
addContentPropertyToDocUsingCache(newDoc, cachedDoc, propertyQName, (ContentPropertyValue) singleValue, transform);
}
}
}
} else {
// NULL property
newDoc.addField(FIELD_NULLPROPERTIES, propertyQName.toString());
}
}
}
Aggregations