Re: PAGE SUBSET SEARCHING
"Graham Honey" <[email protected]> Tue, 4 Dec 2007 09:38:11 +1030
| Newsgroups | gmane.comp.cms.jahia.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Philippe, Many thanks for your help. Looking through the information you have provided does not provide information on how to search a particular pageID and all its children i.e. page subset searching. I have tried to implement the functionality as detailed on page 84 of the template development guide for Jahia 5. Changes had to be made to make it work for me, but it still doesn't capture just the subset, instead it captures every pageID on the site. Is this because Im using the community edition? I presume not. Kind Regards Graham -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Philippe Vollenweider Sent: Friday, November 30, 2007 9:48 PM To: Here you can discuss and comment current and future developments of Jahia Subject: Re: [dev_list] PAGE SUBSET SEARCHING Hi, Here are some adds: query string = "James AND jahia.definition_name:" + "directoryPeopleContainer"; -> will search "James" ina any field in containers "directoryPeopleContainer". - query_string = "jahia.containerfield_" + "directoryPeopleFirstName".toLowerCase() + ":James" -> will search "James" only in fields directoryPeopleFirstName, in all containers And for other lucen constants: jahia.field_id -> limit search to a specific field ID jahia.jahia_id -> limit search to a specific site ID jahia.page_id" -> limit search to a pageID <http://jahia.id>jahia.id -> limit search to a specific container ID, or page ID jahia.parent_id -> limit search to a specific container list ID jahia.containerfield_ + fieldname.toLowerCase() -> limit search to a specific field jahia.content_type -> limit search to a specific content type, value can be JahiaSearchConstant.CONTAINER_TYPE, JahiaSearchConstant.FIELD_TYPE or JahiaSearchConstant.PAGE_TYPE. When searching for containers, jahia.content_type can be either JahiaSearchConstant.CONTAINER_TYPE or JahiaSearchConstant.FIELD_TYPE. jahia.acl_id -> limit search to content with a particular ACL rights jahia.version -> the version id jahia.workflow_state -> limit search to content in a specific staging state where 0=versioned, 1=live, >1 = staged jahia.language_code -> limit search to content in a specific language jahia.definition_name -> limit search to a container with the same definition name or to page with the same definition name. jahia.category_id -> limit search to a specific category Those constans are defined in class org.jahia.services.search.JahiaSearchConstant. I hope it can help you. Philippe. At 29.11.2007 06:52, you wrote: >Content-Class: urn:content-classes:message >Content-Type: multipart/alternative; >boundary="----_=_NextPart_001_01C8324C.1063D36C"; x-avg-checked=avg-ok-7F555923 > >Hi all, > >I hope you can assist. We have used and adapted the code mentioned >on page 84 of the template development guide to enable page subset >searching, however it consistently captures/searches every page >within the site. Instead of just pages under the current >page. The code from the PDF had to be updated to user StringBuilder >as we were getting a number of errors. Does anyone know why this is >capturing every page within the site and not limiting the search >results to the pages under the existing page. > ><http://www.jahia.net/jahia/webdav/site/jahia_net/shared/Documentation/ 5.0.3/Jahia5TemplateDeveloperGuide.pdf>http://www.jahia.net/jahia/webdav /site/jahia_net/shared/Documentation/5.0.3/Jahia5TemplateDeveloperGuide. pdf > >Many thanks in advance. > >Graham > > >Code: > > ><div id="search"> > <form name="searchForm" method="post" > action="<%=jData.gui().html().drawSearchLauncher()%>" > onSubmit="checkMaxPageItems(document.searchForm)" > > <p> > <label>Search for</label> > <input type="text" name="search" > value='<%=JahiaTools.getStrParameter(request,"search","")%>' /> > > <input type="hidden" name="maxPageItems" value="10" /> > <% if (advSearchLicenseEnabled){ %> > ><a >href="javascript:checkMaxPageItems(document.searchForm);setFreeSearchIn put(document.searchForm);document.searchForm.searchView.value='advSearch ';document.searchForm.submit()"><content:resourceBundle >resourceBundle="jahiatemplates.Corporate_portal_templates" >resourceName="search.advancedSearch" defaultValue="Advanced search" /></a> > <% } %> > <input type="hidden" > name="<%=PageSearchResultBuilderImpl.ONE_HIT_BY_PAGE_PARAMETER_NAME%>" > value="true" /> > <input type="hidden" name="searchView" value="simple" /> > <input type="hidden" name="searchHandler" value="advSearch" /> > <input type="hidden" name="freeSearch" value='' /> > <input type="hidden" > name="<%=Search_Engine.SEARCH_REFINE_ATTRIBUTE%>" value="" /> > </p> > <p> > <select name="type"> > <option value="0">All</option> > <option value="1">News</option> > <option value="2">Resource</option> > </select> > </p> > <p class="action"> > <a > href="javascript:checkMaxPageItems(document.searchForm);setFreeSearchInp ut(document.searchForm);submitSimpleSearchForm();document.searchForm.sub mit()"><input > type="image" src="/../images/btn_go.gif" alt="Go" /></a> > </p> > <% > //get the current pageID > ContentPage startPage = > ContentPage.getPage(jData.page().getID()); > //get the list of child pages to construct the query > //retain active and staged pages > int pageInfosFlag = ContentPage.ACTIVE_PAGE_INFOS > | ContentPage.STAGING_PAGE_INFOS; > // SiteMapViewHelper.DISPLAY_ALL_LEVEL means that > all subsequent children under the > // current pageID node in the tree will be returned. > // SiteMapViewHelper.DEFAULT_LEVEL means that > only the immediate children under the > // currentpageID node in the tree will be returned. > FlatSiteMapViewHelper flatSiteMap = new > FlatSiteMapViewHelper(jParams, jParams.getUser(), > startPage, pageInfosFlag, jParams.getLocale().toString(), > FlatSiteMapViewHelper.DEFAULT_LEVEL); > //Append the pageID of selected children to the > current query string > StringBuilder bob = new StringBuilder(); > bob.append("("); > for (int j = 0; j < flatSiteMap.size(); j++) { > int pageId = flatSiteMap.getPageID(j); > if (j > 0){ > bob.append(" OR "); > } > bob.append("pageid:" + pageId ); > } > bob.append(")"); > searchQuery = bob.toString(); > %> > <h2>Current page id: <%= > ContentPage.getPage(jData.page().getID()) %></h2> > <h3>search string: <%= searchQuery %></h3> > <% > %> > </form> ></div> > > >IMPORTANT: This e-mail, including any attachments, may contain >private or confidential information. If you think you may not be the >intended recipient, or if you have received this e-mail in error, >please contact the sender immediately and delete all copies of this >e-mail. If you are not the intended recipient, you must not >reproduce any part of this e-mail or disclose its contents to any >other party. This email represents the views of the individual >sender, which do not necessarily reflect those of education.au >limited except where the sender expressly states otherwise. It is >your responsibility to scan this email and any files transmitted >with it for viruses or any other defects. education.au limited will >not be liable for any loss, damage or consequence caused directly or >indirectly by this email. > >_______________________________________________ >dev_list mailing list >[email protected] >http://lists.jahia.org/cgi-bin/mailman/listinfo/dev_list _______________________________________________ dev_list mailing list [email protected] http://lists.jahia.org/cgi-bin/mailman/listinfo/dev_list IMPORTANT: This e-mail, including any attachments, may contain private or confidential information. If you think you may not be the intended recipient, or if you have received this e-mail in error, please contact the sender immediately and delete all copies of this e-mail. If you are not the intended recipient, you must not reproduce any part of this e-mail or disclose its contents to any other party. This email represents the views of the individual sender, which do not necessarily reflect those of education.au limited except where the sender expressly states otherwise. It is your responsibility to scan this email and any files transmitted with it for viruses or any other defects. education.au limited will not be liable for any loss, damage or consequence caused directly or indirectly by this email. _______________________________________________ dev_list mailing list [email protected] http://lists.jahia.org/cgi-bin/mailman/listinfo/dev_list