Posts

Showing posts with the label document

Reindex the documents

Whenever we are using the lucene search, sometimes content is not able to search even it is present. so we need to reindex the content in the control panel of the server adminstration. We have one more option, when we add the below property it will index the content during the server startup, so manually it is not required to reindex the content in the control panel. So add the below property in the "portal-ext.properties". so it will index during the startup.       # Set this to true if you want to index your entire library of files on     # startup. This property is available so that automated test environments     # index on startup. Do not set this to true on production systems or else     # your index will be indexed on every startup.     #     index.on.startup=true.

Parsing in Liferay(Using SAX Parser reader)

  Liferay provided default classes to parse the xml content.   Have look at this SAXReaderUtil  which will be useful to parse the xml.   For Example:     Consider the WebContent(Journal article) where we have added metadata ,consider to fetch it.    First of all this metadata content will be store in Journal article table of Content column as <?xml version="1.0"?> <root available-locales="en_US" default-locale="en_US">    <dynamic-element instance-id="trtrtrt454" name="Title" type="text" index-type="">         <dynamic-content><![CDATA[Test Title]]></dynamic-content>     </dynamic-element>         <dynamic-element instance-id="Adgbcd456" name="Desc" type="text" index-type="">         <dynamic-content><![CDATA[Test Desc]]></dynamic-content> ...

Liferay boolean query for searching

  By default liferay supports lucene, so how to retrieve entries  Code as follows ,         BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);         BooleanQuery searchQuery = BooleanQueryFactoryUtil.create(searchContext);         Searching the blog           searchQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, BlogsEntry.class.getName());        Adding required terms to search query             searchQuery.addRequiredTerm(Field.ASSET_CATEGORY_IDS, CategoryId);               fullQuery.add(searchQuery, BooleanClauseOccur.MUST);      Adding optional terms where the content should belong to at lease one of these categories            BooleanQuery categ...