Search in sources :

Example 6 with SearchEngineManager

use of org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager in project entando-core by entando.

the class TestSearchEngineManager method testSearchAllContents.

public void testSearchAllContents() throws Throwable {
    try {
        Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences();
        thread.join();
        Set<String> allowedGroup = new HashSet<String>();
        SearchEngineFilter[] filters = {};
        SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager;
        List<String> freeContentsId = sem.searchEntityId(filters, null, allowedGroup);
        assertNotNull(freeContentsId);
        allowedGroup.add(Group.ADMINS_GROUP_NAME);
        List<String> allContentsId = sem.searchEntityId(filters, null, allowedGroup);
        assertNotNull(allContentsId);
        assertTrue(allContentsId.size() > freeContentsId.size());
    } catch (Throwable t) {
        throw t;
    }
}
Also used : SearchEngineFilter(org.entando.entando.aps.system.services.searchengine.SearchEngineFilter) IDataObjectSearchEngineManager(org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager) SearchEngineManager(org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager) HashSet(java.util.HashSet)

Example 7 with SearchEngineManager

use of org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager in project entando-core by entando.

the class TestSearchEngineManager method testFacetedAllContents.

public void testFacetedAllContents() throws Throwable {
    try {
        Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences();
        thread.join();
        SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager;
        Set<String> allowedGroup = new HashSet<String>();
        allowedGroup.add(Group.ADMINS_GROUP_NAME);
        SearchEngineFilter[] filters = {};
        FacetedContentsResult result = sem.searchFacetedEntities(filters, null, allowedGroup);
        assertNotNull(result);
        assertNotNull(result.getContentsId());
        assertNotNull(result.getOccurrences());
        assertTrue(result.getContentsId().size() > 0);
        assertTrue(result.getOccurrences().size() > 0);
    } catch (Throwable t) {
        throw t;
    }
}
Also used : SearchEngineFilter(org.entando.entando.aps.system.services.searchengine.SearchEngineFilter) FacetedContentsResult(org.entando.entando.aps.system.services.searchengine.FacetedContentsResult) IDataObjectSearchEngineManager(org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager) SearchEngineManager(org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager) HashSet(java.util.HashSet)

Aggregations

IDataObjectSearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager)7 SearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager)7 ArrayList (java.util.ArrayList)5 ITreeNode (com.agiletec.aps.system.common.tree.ITreeNode)4 Category (com.agiletec.aps.system.services.category.Category)4 SearchEngineFilter (org.entando.entando.aps.system.services.searchengine.SearchEngineFilter)4 HashSet (java.util.HashSet)2 FacetedContentsResult (org.entando.entando.aps.system.services.searchengine.FacetedContentsResult)2 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)1