Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Searching multiple models at the same time - DXP 7.4
In the documentaiton given below:
https://help.liferay.com/hc/en-us/articles/360034199592-Querying-for-Guestbook-Entry-Documents#implementing-keywordquerycontributor
We need to create an Indexer for the model that we need to search. In this case, GuestBookEntry.class. What if i need to search at the same time on JournalArticle.class and GuestBookEntry.class models, and not separate searches. So that I get a combined search score. How to do this?
Indexer<GuestbookEntry> indexer = IndexerRegistryUtil.getIndexer(GuestbookEntry.class);
IndexerRegistryUtil
has a getIndexers()
method to retrieve all indexers. That said, I'm not exactly sure how
to execute multiple indexer searches at once to get a combined score.
Instead you could perhaps run a regular search using the search APIs,
and filter the models you want returned.
See the Queries and Filters docs, and the docs on Building Queries and Filters, to get started. These links are for 7.2, but they should apply equally to 7.4 (where the docs don't yet exist).
Powered by Liferay™