use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestSearchEngineManager method testSearchContentsId_1.
public void testSearchContentsId_1() throws Throwable {
try {
Content content_1 = this.createContent_1();
this._searchEngineManager.deleteIndexedEntity(content_1.getId());
this._searchEngineManager.addEntityToIndex(content_1);
Content content_2 = this.createContent_2();
this._searchEngineManager.deleteIndexedEntity(content_2.getId());
this._searchEngineManager.addEntityToIndex(content_2);
List<String> contentsId = this._searchEngineManager.searchEntityId("it", "San meravigliosa", null);
assertNotNull(contentsId);
assertTrue(contentsId.contains(content_1.getId()));
contentsId = this._searchEngineManager.searchEntityId("en", "Petersburg wonderful", null);
assertNotNull(contentsId);
assertTrue(contentsId.contains(content_1.getId()));
contentsId = this._searchEngineManager.searchEntityId("en", "meravigliosa", null);
assertNotNull(contentsId);
assertFalse(contentsId.contains(content_1.getId()));
} catch (Throwable t) {
throw t;
}
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestSearchEngineManager method testSearchContentsId_7.
public void testSearchContentsId_7() throws Throwable {
try {
Content content_1 = this.createContent_1();
this._searchEngineManager.deleteIndexedEntity(content_1.getId());
this._searchEngineManager.addEntityToIndex(content_1);
Content content_2 = this.createContent_2();
this._searchEngineManager.deleteIndexedEntity(content_2.getId());
this._searchEngineManager.addEntityToIndex(content_2);
Content content_3 = this.createContent_3();
this._searchEngineManager.deleteIndexedEntity(content_3.getId());
this._searchEngineManager.addEntityToIndex(content_3);
// San Pietroburgo è una città meravigliosa W3C-WAI
// 100
// Il turismo ha incrementato più del 20 per cento nel 2011-2013, quando la Croazia ha aderito all'Unione europea. Consegienda di questo aumento è una serie di modernizzazione di alloggi di recente costruzione, tra cui circa tre dozzine di ostelli.
// 101
// La vita è una cosa meravigliosa
// 103
SearchEngineManager sem = (SearchEngineManager) this._searchEngineManager;
List<String> allowedGroup = new ArrayList<String>();
allowedGroup.add(Group.FREE_GROUP_NAME);
SearchEngineFilter filter1 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.ALL_WORDS);
SearchEngineFilter[] filters1 = { filter1 };
List<String> contentsId = sem.searchEntityId(filters1, null, allowedGroup);
assertNotNull(contentsId);
assertEquals(1, contentsId.size());
assertTrue(contentsId.contains(content_1.getId()));
SearchEngineFilter filter2 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.AT_LEAST_ONE_WORD);
SearchEngineFilter[] filters2 = { filter2 };
contentsId = sem.searchEntityId(filters2, null, allowedGroup);
assertNotNull(contentsId);
assertEquals(2, contentsId.size());
assertTrue(contentsId.contains(content_1.getId()));
assertTrue(contentsId.contains(content_3.getId()));
SearchEngineFilter filter3 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.EXACT);
SearchEngineFilter[] filters3 = { filter3 };
contentsId = sem.searchEntityId(filters3, null, allowedGroup);
assertNotNull(contentsId);
assertEquals(0, contentsId.size());
SearchEngineFilter filter4 = new SearchEngineFilter("it", "una cosa meravigliosa", SearchEngineFilter.TextSearchOption.EXACT);
SearchEngineFilter[] filters4 = { filter4 };
contentsId = sem.searchEntityId(filters4, null, allowedGroup);
assertNotNull(contentsId);
assertEquals(1, contentsId.size());
assertTrue(contentsId.contains(content_3.getId()));
} catch (Throwable t) {
throw t;
}
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestSearchEngineManager method createContent_1.
private Content createContent_1() {
Content content = new Content();
content.setId("100");
content.setMainGroup(Group.FREE_GROUP_NAME);
content.addGroup("secondaryGroup");
content.setTypeCode("ART");
TextAttribute text = new TextAttribute();
text.setName("Articolo");
text.setType("Text");
text.setIndexingType(IndexableAttributeInterface.INDEXING_TYPE_TEXT);
text.setText("San Pietroburgo è una città meravigliosa W3C-WAI", "it");
text.setText("St. Petersburg is a wonderful city", "en");
content.addAttribute(text);
Category category1 = this._categoryManager.getCategory("resCat2");
Category category2 = this._categoryManager.getCategory("general_cat3");
content.addCategory(category1);
content.addCategory(category2);
return content;
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class TestSearchEngineManager method createContent_2.
private Content createContent_2() {
Content content = new Content();
content.setId("101");
content.setMainGroup(Group.FREE_GROUP_NAME);
content.addGroup("thirdGroup");
content.setTypeCode("ART");
TextAttribute text = new TextAttribute();
text.setName("Articolo");
text.setType("Text");
text.setIndexingType(IndexableAttributeInterface.INDEXING_TYPE_TEXT);
text.setText("Il turismo ha incrementato più del 20 per cento nel 2011-2013, quando la Croazia ha aderito all'Unione europea. Consegienda di questo aumento è una serie di modernizzazione di alloggi di recente costruzione, tra cui circa tre dozzine di ostelli.", "it");
text.setText("Tourism had shot up more than 20 percent from 2011 to 2013, when Croatia joined the European Union. Accompanying that rise is a raft of modernized and recently built lodgings, including some three dozen hostels.", "en");
content.addAttribute(text);
Category category1 = this._categoryManager.getCategory("resCat1");
Category category2 = this._categoryManager.getCategory("general_cat2");
content.addCategory(category1);
content.addCategory(category2);
return content;
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.Content in project entando-core by entando.
the class ContentManagerTest method createFakeEntity.
private IApsEntity createFakeEntity(String typeCode, String viewPage, String defaultModel) {
Content content = new Content();
content.setTypeCode(typeCode);
content.setViewPage(viewPage);
content.setDefaultModel(defaultModel);
return content;
}
Aggregations