Fórumok
SearchContainer woes -- can't render certain columns?
Andew Jardine, módosítva 11 év-val korábban
SearchContainer woes -- can't render certain columns?
Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
Help! I'm getting so frustrated with Liferay right now that I am contemplating switching over to the red side (Oracle).
Summary.
1. I query SOLR using the solrj library (works).
2. The result (SolrDocumentList) is added to the renderRequest as an attribute to get it back to the JSP (works).
3. In the JSP I retrieve the list (works).
4. I bind the variable used to store this (searchResults) to the search-container-results (like so)
5. My schema in SOLR has three fields I am concerned with --
name (type="text_general" multiValue="false")
parents (type="text_general" multiValue="true")
children (type="text_general" multiValue="true")
Outputting the name column like so (works).
6. When I try eiher the children or the parents, I get a stack trace --
.. the stack trace ultimately giving a null pointer exception. I checked the portal source and the columns want Strings... and the toString() generates one. The only difference really is that for the name its a single value and when I toString() the list for parents I get "[name, name. name]". I even went as far as to create a String variable, set it using THE SAME CODE, and then adding teh variable to the column, which works?!
I don't understand what the issue is. Any help would be appreciated.
Summary.
1. I query SOLR using the solrj library (works).
2. The result (SolrDocumentList) is added to the renderRequest as an attribute to get it back to the JSP (works).
renderRequest.setAttribute("searchResults", resultsList);
3. In the JSP I retrieve the list (works).
int recordCount = 0;
SolrDocumentList searchResults = (SolrDocumentList)renderRequest.getAttribute("searchResults");
if ( searchResults != null )
recordCount = searchResults.size();
4. I bind the variable used to store this (searchResults) to the search-container-results (like so)
<liferay-ui:search-container-results results="<%= searchResults %>" total="<%= recordCount %>">
</liferay-ui:search-container-results>
5. My schema in SOLR has three fields I am concerned with --
name (type="text_general" multiValue="false")
parents (type="text_general" multiValue="true")
children (type="text_general" multiValue="true")
Outputting the name column like so (works).
<liferay-ui:search-container-column-text name="skill" value="<%= solrDocument.getFieldValue("name").toString() %>" />
6. When I try eiher the children or the parents, I get a stack trace --
<liferay-ui:search-container-column-text name="skill" value="<%= solrDocument.getFieldValue("parents").toString() %>" />
.. the stack trace ultimately giving a null pointer exception. I checked the portal source and the columns want Strings... and the toString() generates one. The only difference really is that for the name its a single value and when I toString() the list for parents I get "[name, name. name]". I even went as far as to create a String variable, set it using THE SAME CODE, and then adding teh variable to the column, which works?!
I don't understand what the issue is. Any help would be appreciated.
Andew Jardine, módosítva 11 év-val korábban
[SOLVED]RE: SearchContainer woes -- can't render certain columns?
Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
In the end this (thanks to Ray for this one) did it for me --
.. which I swear I had tried. Interestingly though, if I use the same code, but place .toString() on the end it fails. Anyway, that's what solved it for me.
<liferay-ui:search-container-column-text name="Parents">
<%= solrDocument.getFieldValue("parents") %>
</liferay-ui:search-container-column-text>
.. which I swear I had tried. Interestingly though, if I use the same code, but place .toString() on the end it fails. Anyway, that's what solved it for me.