Message Boards

Unable to search expired web content in the control panel

Darryl Kpizingui, modified 3 Years ago.

Unable to search expired web content in the control panel

Junior Member Posts: 82 Join Date: 1/10/13 Recent Posts

Hi,

I did a migration from Liferay 6.2 to 7.3. The migration went well. I realised that it not not possible in Liferay 7.3 to search for expired or deprecated web content in the administration.

No web content is shown when a text is put in the search bar and the filter "With with expired version" is selected.

Also the search is not working when the filter "Mine", "Recent" or "Structure" is selected. As the keyword typed in the search bar is not used to fetch the contents. I can find that code in the class JournalDisplayContext.java in the project Journal-Web.

	private SearchContainer _getArticlesSearchContainer() throws PortalException {


		if (isNavigationMine() || isNavigationRecent()) {
			
			//Search keyword is not used here

			List results = JournalArticleServiceUtil.getGroupArticles(
				_themeDisplay.getScopeGroupId(), _themeDisplay.getUserId(),
				getFolderId(), getStatus(), includeOwner,
				articleSearchContainer.getStart(),
				articleSearchContainer.getEnd(),
				articleSearchContainer.getOrderByComparator());

			articleSearchContainer.setResults(results);
		}
		else if (Validator.isNotNull(getDDMStructureKey())) {

			//Search keyword is not used here

			List results = JournalArticleServiceUtil.getArticlesByStructureId(
				_themeDisplay.getScopeGroupId(), getDDMStructureKey(),
				getStatus(), articleSearchContainer.getStart(),
				articleSearchContainer.getEnd(),
				articleSearchContainer.getOrderByComparator());

			articleSearchContainer.setResults(results);
		}
		else if (isSearch()) {
			
			Indexer indexer = JournalSearcher.getInstance();

			/*
			* Here the Keyword is used for the search, but no expired content is retrieved
			*/
			SearchContext searchContext = buildSearchContext(
				folderIds, articleSearchContainer.getStart(),
				articleSearchContainer.getEnd(), sort, false);

			Hits hits = indexer.search(searchContext);
		}
		else {
		
			//Default when no keyworkd is used

			List results = JournalFolderServiceUtil.getFoldersAndArticles(
				_themeDisplay.getScopeGroupId(), 0, getFolderId(), getStatus(),
				_themeDisplay.getLocale(), articleSearchContainer.getStart(),
				articleSearchContainer.getEnd(), folderOrderByComparator);

			articleSearchContainer.setResults(results);
		}

		//...
	}

 

Do you know if is there a way I can eaily search for deprecated or expired web content? I was not able to find a config that can solve this issue.
I am trying to find a way to create a override jar, so the user of the portal can continue their work.

Darryl Kpizingui, modified 3 Years ago.

RE: Unable to search expired web content in the control panel

Junior Member Posts: 82 Join Date: 1/10/13 Recent Posts

Hi,

I was able to create my override of com.liferay.journal.web-4.0.21.jar. Now I can search and see my expired contents

I  also find that there might be a flaw in the implementation of the method JournalDisplayContext.buildSearchContext(...)

protected SearchContext buildSearchContext(int start, int end, boolean showVersions) {

		SearchContext searchContext = new SearchContext();

		searchContext.setAndSearch(false);
		searchContext.setAttribute("head", Boolean.TRUE);
		searchContext.setAttribute("latest", Boolean.TRUE);

		LinkedHashMap<String, Object> params;
		params  =	LinkedHashMapBuilder.<String, Object>put(
																"expandoAttributes", getKeywords()
															).put(
																"keywords", getKeywords()
															).build();

		searchContext.setAttribute("params", params);

		if (!showVersions) {
			searchContext.setAttribute("showNonindexable", Boolean.TRUE);
		}

		//Flaw??? searchContext.setAttributes replace all the previous attributes
		searchContext.setAttributes(
			HashMapBuilder.<String, Serializable>put(Field.ARTICLE_ID, getKeywords())
						  .put(Field.CLASS_NAME_ID, JournalArticleConstants.CLASS_NAME_ID_DEFAULT)
						  .put(Field.CONTENT, getKeywords())
						  .put(Field.DESCRIPTION, getKeywords())
						  .put(Field.STATUS, getStatus())
						  .put(Field.TITLE, getKeywords())
						  .put("params", params)
							.build());

		//..
	}

 

thumbnail
Russell Bohl, modified 3 Years ago.

RE: RE: Unable to search expired web content in the control panel

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

Thanks for the report: I've shared your post and my attached GIF internally with the team who works on Web Content, and they're looking into it further.

 

 

thumbnail
Russell Bohl, modified 3 Years ago.

RE: Unable to search expired web content in the control panel

Expert Posts: 291 Join Date: 2/13/13 Recent Posts