<div dir="ltr">Hi everybody,<div>we have noticed that workplace search is not working correctly (well, as expected).</div><div><br></div><div>Scenario:</div><div>Given I have adequate privileges (i.e. admin), </div><div>And I select a specific site, i.e "news" (yes, we are in multi-site setup) on project offline <br></div><div>And I have created a sample content with "sometext" contained in a relevant field (title, description, body, etc)</div><div>When I click the search button and query for "sometext"</div><div>Then I expect the search results show the sample content</div><div><br></div><div><br></div><div>Unfortunately, it does not show anything. Digging in the code I found that a recent fix (9_5_0 is not affected, 9_5_1 is) adds the site root to the query parameters:</div><div><br></div><div>//CmsSearchResourceCollector.java</div><div>private CmsSearch getSearchBean(Map<String, String> params) {<br></div><div>[...]</div><div><div>for (int i = 0; i < searchRoots.length; i++) {</div><div> searchRoots[i] = getWp().getCms().addSiteRoot(searchRoots[i]);</div><div>}</div><div><br></div><div><br></div><div>But this conflicts with the Search Bean, which adds *again* the siteRoot.</div><div><div>//CmsSearchIndex.java</div><div>protected BooleanFilter appendPathFilter(CmsObject cms, BooleanFilter filter, List<String> roots) {<br></div></div><div>...</div><div>String searchRoot = cms.getRequestContext().addSiteRoot(roots.get(i));<br></div><div>...</div><div><br></div><div>This is a prospective pull request I would like to start, but before pushing it I would like your advice ,as this core service may be used by many more services than i may expect.</div><div><br></div><div>//CmsSearchIndex.java</div><div><br></div><div><div>protected BooleanFilter appendPathFilter(CmsObject cms, BooleanFilter filter, List<String> roots) {</div><div><br></div><div> // complete the search root</div><div> List<Term> terms = new ArrayList<Term>();</div><div> if ((roots != null) && (roots.size() > 0)) {</div><div> // add the all configured search roots with will request context</div><div> for (int i = 0; i < roots.size(); i++) {</div><div> LOG.debug("ENRICO appendPathFilter root PRE(" + i + "): " + roots.get(i));<br></div><div> LOG.debug("ENRICO appendPathFilter siteRoot PRE(" + i + "): " + cms.getRequestContext().getSiteRoot());</div><div>// String searchRoot = cms.getRequestContext().addSiteRoot(roots.get(i));</div><div> //EM 2015-05-05 These roots are already "getSiteRooted"</div><div> String searchRoot = roots.get(i);</div><div> LOG.debug("ENRICO appendPathFilter siteRoot POST(" + i + "): " + searchRoot);</div><div> extendPathFilter(terms, searchRoot);</div><div> }</div></div><div><br></div><div>thanks for your patience and time.</div><div>Cheers,</div><div>Enrico Marongiu</div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><a href="http://about.me/cernio" style="margin:0px;padding:0px;border:0px;outline:0px;font-size:14px;font-family:proxima-nova-1,proxima-nova-2,Tahoma,Helvetica,Verdana,sans-serif;vertical-align:baseline;color:rgb(43,130,173);text-decoration:none;line-height:18.2000007629395px" target="_blank"><table border="0" cellpadding="0" cellspacing="0" style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline;border-spacing:0px"><tbody style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><tr style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><td colspan="3" style="padding:0px;border:0px;outline:0px;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseline;height:30px"> </td></tr><tr style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><td align="left" valign="top" style="padding:0px;border:0px;outline:0px;font-style:inherit;font-family:inherit;vertical-align:top;line-height:1"><div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><img src="http://d3mod6n032mdiz.cloudfront.net/thumb2/c/e/r/cernio/cernio-105x70.jpg" alt="Enrico Marongiu on about.me" width="96" height="64" style="margin: 0px; padding: 0px; border: 1px solid rgb(238, 238, 238); outline: 0px; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; display: block;"></div></td><td style="padding:0px;border:0px;outline:0px;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseline;width:10px"> </td><td align="left" valign="bottom" style="padding:0px 0px 3px;border:0px;outline:0px;font-style:inherit;font-family:inherit;vertical-align:bottom;line-height:1"><div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:bold;font-style:inherit;font-size:18px;font-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline;line-height:1;color:rgb(51,51,51)">Enrico Marongiu</div><div style="margin:1px 0px 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:12px;font-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline">about.me/cernio</div><div style="margin:1px 0px 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:12px;font-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline">skype: cerionmorgauin</div></td></tr><tr style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><td colspan="3" style="padding:0px;border:0px;outline:0px;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseline;height:20px"> </td></tr></tbody></table></a></div></div>
</div></div>