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
DXP 7.1 Search result customization
Hello,
I want to customize the search result to show certain results to appear at the top of the result when related search is performed.
Any pointer on this is appreciated.
Using DXP 7.1
Thanks
If you're a DXP subscriber, upgrade to 7.2 (might as well go to 7.3?) and you'll have access to a Search Tuning feature called Result Rankings
Not sure how you can homecook something like this, but I'm sure it's possible.
Hello Russell,
Thanks for your reply.
Since i donot have a upgrade plan as of now, So I am looking for a solution for DXP 7.1 only.
Hi,
I am trying to achieve this through KeywordQueryContributor. Not sure but giving a try. But after deploying the module, contribute method is not getting called.My requirement is for web contents so mentioned the indexer.class.name=com.liferay.journal.model.JournalArticle
import com.liferay.portal.kernel.search.BooleanQuery;
import com.liferay.portal.kernel.search.Field;
import com.liferay.portal.search.query.QueryHelper;
import com.liferay.portal.search.spi.model.query.contributor.KeywordQueryContributor;
import com.liferay.portal.search.spi.model.query.contributor.helper.KeywordQueryContributorHelper;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import com.liferay.portal.kernel.search.SearchContext;
@Component(
immediate = true,
property = "indexer.class.name=com.liferay.journal.model.JournalArticle",
service = KeywordQueryContributor.class
)
public class AllKeywordQueryContributor implements KeywordQueryContributor {
@Override
public void contribute(
String keywords, BooleanQuery booleanQuery,
KeywordQueryContributorHelper keywordQueryContributorHelper) {
queryHelper.addSearchLocalizedTerm(
booleanQuery, keywordQueryContributorHelper.getSearchContext(),
Field.TITLE, true);
}
@Reference
protected QueryHelper queryHelper;
}
build.gradle
dependencies {
compileOnly group: "biz.aQute.bnd",
name: "biz.aQute.bndlib", version: "3.1.0"
compileOnly group: "com.liferay", name:
"com.liferay.portal.search.api", version:
"2.0.0"
compileOnly group: "com.liferay",
name: "com.liferay.portal.search.spi", version:
"2.0.0"
compileOnly group:
"com.liferay.portal", name:
"com.liferay.portal.kernel", version: "3.0.0"
}
Any idea??
Powered by Liferay™