Jahia Template Forum > Steps to implement...

0 (0 Good)
0 (0 Bad)

Steps to implement a search

by  new_to_jahia »  2011/06/07 20:03

Hello,

I want to implement a search form in my pages and I do not know exactly what are the steps involved in doing so. Are the search tags sufficient in doing this or is there some Java code that I have to write to perform the search?

Can someone specify what are the steps to perform when implementing a functional search form?

Thank you.
  • Steps to implement a search
    2011/06/07 20:03

    new_to_jahia Hello,<br/><br/>I want to implement a search form in my pages and I do not know exactly what are the steps involved in doing so. Are the search tags sufficient in doing this or is there some Java code that I have to write to perform the search?<br/><br/>Can someone specify what are the steps to perform when implementing a functional search form?<br/><br/>Thank you.

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  theklem »  2011/06/07 20:03

    Hello,

    when you say that you want to imlement a search in your pages, I imagine that you've done your own set of templates, I'm I right ?
    If this is the case, you can just start by copy the search forms provided in the defaullt templates provided with the application (web-templates) and paste the one you want (simple or advanced search form) at the desired place in your templates.

    You can also copy the search-result template (jsp file) and add it in your template set or copy-paste the code if you have a specific design (don't forget to declare the search-result page in your templates.xml file)

    The customization of the search is feasible with tags only, you don't neeed to write java code at all. You can pass params to modify the behaviour, reduce the search scope for instance to a root path, or a content type, or specific fields only.

    Don't hesitate to ask us more precise questions if you have problems or mis-andurstand something.

    Regards.
    Cl?�ment
  • Re: Steps to implement a search
    2011/06/07 20:03

    theklem Hello,<br/><br/>when you say that you want to imlement a search in your pages, I imagine that you've done your own set of templates, I'm I right ?<br/>If this is the case, you can just start by copy the search forms provided in the defaullt templates provided with the application (web-templates) and paste the one you want (simple or advanced search form) at the desired place in your templates.<br/><br/>You can also copy the search-result template (jsp file) and add it in your template set or copy-paste the code if you have a specific design (don't forget to declare the search-result page in your templates.xml file)<br/><br/>The customization of the search is feasible with tags only, you don't neeed to write java code at all. You can pass params to modify the behaviour, reduce the search scope for instance to a root path, or a content type, or specific fields only.<br/><br/>Don't hesitate to ask us more precise questions if you have problems or mis-andurstand something.<br/><br/>Regards.<br/>Cl?�ment

  • Number of messages  85
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  new_to_jahia »  2011/06/07 20:03

    Hello,

    This is what I have done so far:

    1. I created some simple templates with a few fields in it (some text fields, an image etc);
    2. I then accessed the application and added some content to the site, based on the template.
    3. I now have some data in my site and I want to perform a search for different information;
    4. I looked into the ACME application to see how the search form is created.
    5. Based on that I saw that my search fields will be wrapped in a form by the lt;s:form
  • Re: Steps to implement a search
    2011/06/07 20:03

    new_to_jahia Hello,<br/><br/>This is what I have done so far:<br/><br/>1. I created some simple templates with a few fields in it (some text fields, an image etc);<br/>2. I then accessed the application and added some content to the site, based on the template.<br/>3. I now have some data in my site and I want to perform a search for different information;<br/>4. I looked into the ACME application to see how the search form is created.<br/>5. Based on that I saw that my search fields will be wrapped in a form by the lt;s:form

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  new_to_jahia »  2011/06/07 20:03

    I just found [url=http#58;//www
  • Re: Steps to implement a search
    2011/06/07 20:03

    new_to_jahia I just found [url=http#58;//www

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  shyrkov »  2011/06/07 20:03

    Hello,

    could you try to reindex your virtual site (in Jahia Administration)? It could be that the index is inconsistent.

    Besides a simple and advanced search forms, that are included with the Web Templates set, there are also several examples or search forms, included into the TCK template set, delivered with Jahia: the [url=http#58;//subversion

    Sergiy Shyrkov (shyrkov)

    Number of messages  407
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  new_to_jahia »  2011/06/07 20:03

    Hello Sergiy,

    Thank you for your reply. I did as you said and reindexed the site from the administration console, but I still get only one result and the text like [b:3r3d026a]default:a8cbe7e0-1d62-40b7-9718-f3135ee70a31[/b:3r3d026a] is still present in the result page. what else could cause this?
  • Re: Steps to implement a search
    2011/06/07 20:03

    new_to_jahia Hello Sergiy,<br/><br/>Thank you for your reply. I did as you said and reindexed the site from the administration console, but I still get only one result and the text like [b:3r3d026a]default:a8cbe7e0-1d62-40b7-9718-f3135ee70a31[/b:3r3d026a] is still present in the result page. what else could cause this?

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  shyrkov »  2011/06/07 20:03

    Hello,

    could you, please, post the complete code of your results page? For troubleshooting purpose, can you try displaying the results without the pager tags?

    Kind regards
    Sergiy

    Sergiy Shyrkov (shyrkov)

    Number of messages  407
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  new_to_jahia »  2011/06/07 20:03

  • Re: Steps to implement a search
    2011/06/07 20:03

    new_to_jahia

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  new_to_jahia »  2011/06/07 20:03

    Hello,

    I removed the lt;pg:pager
  • Re: Steps to implement a search
    2011/06/07 20:03

    new_to_jahia Hello,<br/><br/>I removed the lt;pg:pager

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Steps to implement a search

    by  new_to_jahia »  2011/06/07 20:03

    Hello,

    I managed to track down one of the issues I was having with the search. I still get weird text in my results ([i:4c6vcexw]default:a8cbe7e0-1d62-40b7-9718-f3135ee70a31[/i:4c6vcexw]) but I now have two results returned?Ķ well sort of.

    I had a page with some news summaries in it and did a search with keywords that should have returned two results (two news details) but only got one. In the [i:4c6vcexw]org.jahia.services.search.PageSearchResultBuilderImpl.shouldAddHit [/i:4c6vcexw]method a test was done that excluded the other search hit (Lucene initially returned two hits).

    The [i:4c6vcexw]onlyOneHitByPage[/i:4c6vcexw] parameter is used. This is specified in the [i:4c6vcexw]PageSearchResultBuilderImpl [/i:4c6vcexw]constructor. But my search ends up calling the default constructor which just specified this hardcoded to true:
    [code:4c6vcexw]
    public PageSearchResultBuilderImpl() {
    this(true);
    }

    public PageSearchResultBuilderImpl(boolean onlyOneHitByPage) {
    #46;
  • Re: Steps to implement a search
    2011/06/07 20:03

    new_to_jahia Hello,<br/><br/>I managed to track down one of the issues I was having with the search. I still get weird text in my results ([i:4c6vcexw]default:a8cbe7e0-1d62-40b7-9718-f3135ee70a31[/i:4c6vcexw]) but I now have two results returned?Ķ well sort of.<br/><br/>I had a page with some news summaries in it and did a search with keywords that should have returned two results (two news details) but only got one. In the [i:4c6vcexw]org.jahia.services.search.PageSearchResultBuilderImpl.shouldAddHit [/i:4c6vcexw]method a test was done that excluded the other search hit (Lucene initially returned two hits).<br/><br/>The [i:4c6vcexw]onlyOneHitByPage[/i:4c6vcexw] parameter is used. This is specified in the [i:4c6vcexw]PageSearchResultBuilderImpl [/i:4c6vcexw]constructor. But my search ends up calling the default constructor which just specified this hardcoded to true:<br/>[code:4c6vcexw]<br/>public PageSearchResultBuilderImpl() {<br/> this(true);<br/>}<br/><br/>public PageSearchResultBuilderImpl(boolean onlyOneHitByPage) {<br/> #46;

  • Number of messages  18
    Registration date Jun 7, 2011
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page