Foros de discusión

how to add search capabilities for custom entity?

thumbnail
Ranga Rao Bobbili, modificado hace 11 años.

how to add search capabilities for custom entity?

Regular Member Mensajes: 152 Fecha de incorporación: 20/07/07 Mensajes recientes
Hi All,

I have successfully integrated solr search engine to liferay 6.1 CE and able to index entities(Liferay+custom entities).

But when i retrieve data from solr search engine, i am getting zero hits. Please find the below steps and let me know my mistakes.

Step1: Custom Table script
(CREATE TABLE `libertycare`.`liberty_program` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`lpName` varchar(250) NOT NULL DEFAULT '',
`type` varchar(45) NOT NULL DEFAULT '',
`created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`companyId` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)) ;)

Step2: Created custom portlet and custom entity(LibertyProgram)service classes using ServiceBuilder tool.

Step3: Created LibertyProgramIndexer.java by extending BaseIndexer.

Step4: Added LibertyProgramIndexer class to indexer-class element inside liferay-portlet.xml.
<indexer-class>com.xerox.ghs.he.portlet.searchentity.util.LibertyProgramIndexer</indexer-class>


Step5: Created search.jsp and retrived results but getting zero hits.

Indexer indexer = IndexerRegistryUtil.getIndexer(LibertyProgram.class);
SearchContext searchContext = SearchContextFactory.getInstance(request);
searchContext.setAttribute("paginationType", "regular");
searchContext.setEnd(searchContainer.getEnd());
searchContext.setKeywords(keywords);
searchContext.setStart(searchContainer.getStart());
Hits results = indexer.search(searchContext);


Step6: Deployed custom portlet and indexed custom entity from ServerAdministration tab from controlpanel.

Step7: I am able to find the indexed data. But when i retrieve data from solr, i am getting zero hits.

Could you please provide me the valuable inputs to retrieve indexed data from solr.

Thanks in advance................

Best Regards,
Ranga Rao Bobbili
Adaequare INC

Archivos adjuntos:

thumbnail
Chirag Patadia, modificado hace 11 años.

RE: how to add search capabilities for custom entity?

Junior Member Mensajes: 29 Fecha de incorporación: 3/02/12 Mensajes recientes
Hi,

Can you also share snapshot which contains data inside Solr?
thumbnail
Ranga Rao Bobbili, modificado hace 11 años.

RE: how to add search capabilities for custom entity?

Regular Member Mensajes: 152 Fecha de incorporación: 20/07/07 Mensajes recientes
Chirag Patadia:
Hi,

Can you also share snapshot which contains data inside Solr?


Thank you Chirag Patadia for swift response.
I already shared solr admin schema browser page snapshot.
Let me know, do i need to share data folder screenshot.

Thanks,
Ranga Rao Bobbili
Adaequare INC
thumbnail
Ranga Rao Bobbili, modificado hace 11 años.

RE: how to add search capabilities for custom entity?

Regular Member Mensajes: 152 Fecha de incorporación: 20/07/07 Mensajes recientes
Hi All, please help me to resolve the following issue.

I am able to query solr but no results, below query showing different paramters in the solr log message. But i am not passing assetTagNames, groupid,scopreGroupId, comments,description,properties,title,url,userName,content etc... parameters in the solr console log message.

My Query
Indexer indexer = IndexerRegistryUtil.getIndexer(LibertyProgram.class);
SearchContext searchContext = SearchContextFactory.getInstance(request);
searchContext.setCompanyId(10154);
searchContext.setKeywords(keywords);
Hits results = indexer.search(searchContext);



Solr Log Message
INFO: [] webapp=/solr path=/select params={hl.fragsize=80&fl=score&hl.snippets=3&q=%2B(%2B((%2B(entryClassName:com.xerox.ghs.he.portlet.searchentity.model.LibertyProgram)))
+%2B(%2B(groupId:10180)+%2B(scopeGroupId:10180)))+%2B(assetCategoryTitles:Xerox*+assetTagNames:Xerox*+comments:xerox+
content:xerox+description:xerox+properties:xerox+title:xerox+url:xerox+userName:Xerox*)+%2BcompanyId:10154&
facet.limit=-1&hl.fl=content&hl.fl=content_en_US&hl.fl=title&hl.fl=title_en_US&wt=javabin&hl=true&rows=0&version=1} hits=0 status=0 QTime=48


Liferay experts,friends, please let me know the solution to resolve above issue.

Thanks in advance...............

Best Regards,
Ranga Rao Bobbili
Adaequare INC
Oliver Bayer, modificado hace 11 años.

RE: how to add search capabilities for custom entity?

Liferay Master Mensajes: 894 Fecha de incorporación: 18/02/09 Mensajes recientes
Hi Ranga,

I've never used Solr so I'm not really an expert but maybe you can use my hints anyhow to narrow it down:
  • Please check if Solr has some indexed contents.
  • Do you have a tool similar to luke (to check the lucene index) to search directy at Solr level?
  • If yes use the search query and check if Solr is returning any results.
  • If not simplify the search query (e.g. by removing search parameters) until you will get a result.
  • Now compare the search queries to know where the error occurs: at Solr or in Liferay (that means in your search class).

HTH Oli
thumbnail
Ranga Rao Bobbili, modificado hace 10 años.

RE: how to add search capabilities for custom entity?

Regular Member Mensajes: 152 Fecha de incorporación: 20/07/07 Mensajes recientes
Thanks Oliver Bayer for quick response.

I have fixed all issues related to Solr search for custom entity. The main issue is with solr-web community endition plugins.

Thanks & Regards,
Ranga Rao Bobbili
Adaequare INC