Main Content

Magnolia Community Forums: Get help with Magnolia: Search not returning values


  • pedro
    pedro
    Full name: Pedro
    Posts: 11
    Last post: Sep 26, 2017 12:51:35 PM
    Registered on: Jul 27, 2017
    Search not returning values
    #1 by pedro on Jul 31, 2017 7:22:22 PM

    Hi to everyone,
    I'm trying to make a search field to look for components/areas/pages added by the user to create a page following this documentation.
    My actual code in a template:
    [#assign searchResults = searchfn.searchContent("website", "a", "/home", "mgnl:area") /]
    [#assign recordsFound = searchResults?size /]
    <p>RESULTS: ${recordsFound!}</p>

    [#if searchResults?has_content]
    [#list searchResults as item]
    <p> each result </p>
    [/#list]
    [/#if]


    Some explanation:
    - I'm using magnolia standard version;
    - I'm using jackrabbit-bundle-mysql-search as database;
    - My database is up and runing;
    - searchfn is uncommented in freemarker rendering configurations;

    And my questions:
    1- Do I need to change something in magnolia.properties to make search working?
    2- Do I need to create a java class to control search
    3- Do I need extra dependencies?
    4- Where I can see the information stored by search so I could use it like in this example?
    5- How can I change indexing_configuration.xml? I'have stored mine in same folder as jackrabbit-bundle-mysql-search and pointing the parameter as <param name="indexingConfiguration" value="/indexing_configuration.xml"/> but is seems that magnolia can't find it...
    6- Do I need to change something in magnolia configuration/definitions apps?


    Answering my questions will help a lot and guide me somewhere.

    Thanks in advance.
    Happy coding!

  • pedro
    pedro
    Full name: Pedro
    Posts: 11
    Last post: Sep 26, 2017 12:51:35 PM
    Registered on: Jul 27, 2017
    Search not returning values
    #2 by pedro on Jul 31, 2017 7:22:27 PM

    Hi to everyone,
    I'm trying to make a search field to look for components/areas/pages added by the user to create a page following this documentation.
    My actual code in a template:
    [#assign searchResults = searchfn.searchContent("website", "a", "/home", "mgnl:area") /]
    [#assign recordsFound = searchResults?size /]
    <p>RESULTS: ${recordsFound!}</p>

    [#if searchResults?has_content]
    [#list searchResults as item]
    <p> each result </p>
    [/#list]
    [/#if]


    Some explanation:
    - I'm using magnolia standard version;
    - I'm using jackrabbit-bundle-mysql-search as database;
    - My database is up and runing;
    - searchfn is uncommented in freemarker rendering configurations;

    And my questions:
    1- Do I need to change something in magnolia.properties to make search working?
    2- Do I need to create a java class to control search
    3- Do I need extra dependencies?
    4- Where I can see the information stored by search so I could use it like in this example?
    5- How can I change indexing_configuration.xml? I'have stored mine in same folder as jackrabbit-bundle-mysql-search and pointing the parameter as <param name="indexingConfiguration" value="/indexing_configuration.xml"/> but is seems that magnolia can't find it...
    6- Do I need to change something in magnolia configuration/definitions apps?


    Answering my questions will help a lot and guide me somewhere.

    Thanks in advance.
    Happy coding!

  • rgange
    rgange
    Full name: Richard Gange
    Posts: 49
    Last post: Oct 16, 2017 3:21:08 PM
    Re: Search not returning values
    #3 by rgange on Aug 7, 2017 2:51:28 PM

    Hello Pedro-

    I'm not sure what you are trying to accomplish but maybe I can help clear a few things up for you.

    First of all, if you'd like to search the pages for content that I would suggest you use searchfn.searchPages() rather than searchfn.searchContent().

    Secondly, the indexing_configuration file can be found inside the core module within the package info.magnolia.jackrabbit. If you would like more detailed information then have a look here: https://wiki.magnolia-cms.com/display/WIKI/Search+Index+Configuration+File.

    HTH
    Rich

  • rgange
    rgange
    Full name: Richard Gange
    Posts: 49
    Last post: Oct 16, 2017 3:21:08 PM
    Re: Search not returning values
    #4 by rgange on Aug 7, 2017 2:53:16 PM

    Also this might be helpful as well: https://documentation.magnolia-cms.com/display/DOCS/Search

  • pedro
    pedro
    Full name: Pedro
    Posts: 11
    Last post: Sep 26, 2017 12:51:35 PM
    Registered on: Jul 27, 2017
    Re: Search not returning values
    #5 by pedro on Aug 14, 2017 5:56:01 PM

    I've already changed to search the pages, but that didn't solve my problem, I keep getting 0 results.
    I'm trying to make a search form on my template where a user (website user) could look for content, files and pages inside all website.
    And I was looking to create my own indexing_configuration file to boost some atributes and get better results on my search, but at the moment I'm using the package one.

    More in dept: I'm trying to accomplish a FTL get method where a user could insert a parameter on the form, like "mywebsite.on/theweb?searchParam=a" (as you can see, atm this parameter is static), then be redirect to another page with all results.
    Something just like the one implemented on Travel Demo.

    Thanks for the help :)

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/