Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Ranga Rao Bobbili
how to add search capabilities for custom entity?
6. Februar 2013 12:14
Antwort

Ranga Rao Bobbili

Rang: Regular Member

Nachrichten: 148

Eintrittsdatum: 20. Juli 2007

Neue Beiträge

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
Anhang

Anhänge: solr.png (205,7k)
Chirag Patadia
RE: how to add search capabilities for custom entity?
3. Februar 2013 21:39
Antwort

Chirag Patadia

Rang: Junior Member

Nachrichten: 29

Eintrittsdatum: 2. Februar 2012

Neue Beiträge

Hi,

Can you also share snapshot which contains data inside Solr?
Ranga Rao Bobbili
RE: how to add search capabilities for custom entity?
4. Februar 2013 07:25
Antwort

Ranga Rao Bobbili

Rang: Regular Member

Nachrichten: 148

Eintrittsdatum: 20. Juli 2007

Neue Beiträge

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
Ranga Rao Bobbili
RE: how to add search capabilities for custom entity?
6. Februar 2013 12:12
Antwort

Ranga Rao Bobbili

Rang: Regular Member

Nachrichten: 148

Eintrittsdatum: 20. Juli 2007

Neue Beiträge

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
RE: how to add search capabilities for custom entity?
8. Februar 2013 03:41
Antwort

Oliver Bayer

Rang: Liferay Master

Nachrichten: 867

Eintrittsdatum: 18. Februar 2009

Neue Beiträge

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
Ranga Rao Bobbili
RE: how to add search capabilities for custom entity?
10. April 2013 12:53
Antwort

Ranga Rao Bobbili

Rang: Regular Member

Nachrichten: 148

Eintrittsdatum: 20. Juli 2007

Neue Beiträge

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