Foren

Search on the basis of content's status

thumbnail
Muhammad Junaid Ansari, geändert vor 9 Jahren.

Search on the basis of content's status

New Member Beiträge: 2 Beitrittsdatum: 09.01.14 Neueste Beiträge
Hi everyone,
How can we search in Lifearay Document and media portlet on the basis of content's status like (Draft, Approved etc).
we are using lucene search for this purpose. We have done searching on the basis of other metadata but could not find a proper mechanism for searching on the basis of status.

Any help is really appriciated
Thanks.
thumbnail
Jeffrey Paul Handa, geändert vor 9 Jahren.

RE: Search on the basis of content's status

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
Hi Muhammad,

I don't have a specific answer, but when I need to better understand how Liferay search works and possibly customize it there are two good resources:
  • Luke is a handy little tool that will allow you to examine what's actually ending up in the Lucene index.
  • Indexer Post Processor Hooks allow you to modify results, indexes, and queries.


Hope that points you in the right direction.
thumbnail
Muhammad Junaid Ansari, geändert vor 9 Jahren.

RE: Search on the basis of content's status

New Member Beiträge: 2 Beitrittsdatum: 09.01.14 Neueste Beiträge
Thanks for the help Jeffery, Extending the Indexer Post Processor is an interesting topic and I have learned new things from it. I tried to implement an indexer for DLFileEntry but could not make a successful indexer for status.

What I have done so far is following.

liferay-hook.xml
<indexer-post-processor>
<indexer-class-name>com.liferay.portlet.documentlibrary.model.DLFileEntry</indexer-class-name>
<indexer-post-processor-impl>com.elixir.tango.helium.indexer.FileEntryIndexerPostProcesser</indexer-post-processor-impl>
</indexer-post-processor>

Java File
public class FileEntryIndexerPostProcesser extends BaseIndexerPostProcessor {
//implementation
}

When I search something in document and media portlet, only 2 callbacks are called by liferay which are postProcessContextQuery and postProcessSummary. This behavior is a little different than the Extending the Indexer Post Processor. However I put document.addNumber(Field.STATUS, document.get("status")); in postProcessSummary.

Can you suggest me some improvement or point my mistake?
thumbnail
Krzysztof Gołębiowski, geändert vor 9 Jahren.

RE: Search on the basis of content's status

Liferay Master Beiträge: 549 Beitrittsdatum: 25.06.11 Neueste Beiträge
Hello Muhammad,
Every Liferay versioned object has the field status, both in database and in Lucene index. I don't know how do you browse the index, but using BooleanClause I suppose it should be something like:

BooleanClause bc = BooleanClauseFactoryUtil.create(
        searchContext, "status", WorkflowConstants.STATUS_APPROVED, BooleanClauseOccur.MUST.getName())

Regards,
KG