Main Content

Magnolia Community Forums: Get help with Magnolia: Search returning 0 results


  • pedro
    pedro
    Full name: Pedro
    Posts: 11
    Last post: Sep 26, 2017 12:51:35 PM
    Registered on: Jul 27, 2017
    Search returning 0 results
    #1 by pedro on Jul 27, 2017 7:34:55 PM

    Hello to everyone,

    I was trying to follow this Documentation to create a internal search engine on the template, but I can't get search results.

    At the moment I created my indexing_configuration.xml to search in components and areas:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE configuration SYSTEM "http://jackrabbit.apache.org/dtd/indexing-configuration-1.2.dtd">
    <configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mgnl="http://www.magnolia.info/jcr/mgnl" xmlns:jcr="http://www.jcp.org/jcr/1.0">
    <!-- custom analyzers for specific properties. For example, don't tokenize tags/keywords -->
    <analyzers>
    <analyzer class="org.apache.lucene.analysis.KeywordAnalyzer">
    <property>tags</property>
    </analyzer>
    </analyzers>

    <index-rule nodeType="nt:hierarchyNode">
    <property boost="10" useInExcerpt="false">title</property>
    <property boost="1.0" useInExcerpt="true">text</property>
    <!-- exclude jcr:* and mgnl:* properties -->
    <property isRegexp="true" nodeScopeIndex="false" useInExcerpt="false">.*:.*</property>
    </index-rule>
    <index-rule nodeType="mgnl:contentNode">
    <property boost="5" nodeScopeIndex="false" useInExcerpt="false">title</property>
    <property boost="2" nodeScopeIndex="false" useInExcerpt="true">text</property>
    <!-- exclude jcr:* and mgnl:* properties -->
    <property isRegexp="true" nodeScopeIndex="false" useInExcerpt="false">.*:.*</property>
    </index-rule>

    <!-- index text content on paragraphs. Can this be configured using nodetypes only? -->
    <aggregate primaryType="mgnl:content">
    <!-- aggregates content on the main column -->
    <include primaryType="mgnl:contentNode">nomeoftheareanode/*</include>
    </aggregate>


    <aggregate primaryType="mgnl:page">
    <include primaryType="mgnl:area">*</include>
    <include primaryType="mgnl:component">*</include>
    </aggregate>

    <!-- areas can be nested. See http://wiki.apache.org/jackrabbit/IndexingConfiguration for recursion -->
    <aggregate primaryType="mgnl:area" recursive="true">
    <include primaryType="mgnl:component">*</include>
    <include primaryType="mgnl:area">*</include>
    </aggregate>

    <!-- index metadata attributes inside the main node, to allow sorting! -->
    <aggregate primaryType="mgnl:content">
    <include>mgnl:creationdate</include>
    <include-property>MetaData/mgnl:creationdate</include-property>
    </aggregate>
    <aggregate primaryType="mgnl:content">
    <include>mgnl:lastmodified</include>
    <include-property>MetaData/mgnl:lastmodified</include-property>
    </aggregate>
    <aggregate primaryType="mgnl:content">
    <include>mgnl:template</include>
    <include-property>MetaData/mgnl:template</include-property>
    </aggregate>

    </configuration>


    and modified the param indexingConfiguration on jackrabbit-memory-search.xml

    and on my template I just used the ftl on documentation as:

    [#-------------- ASSIGNMENTS --------------]
    [#assign queryStr = ctx.getParameter('queryStr')!?html]

    [#-------------- RENDERING --------------]
    [#if content.headline?has_content]
    <h2>${content.headline}</h2>
    [/#if]

    [#if queryStr?has_content]
    [#assign searchResults = searchfn.searchPages(queryStr, '/home') /]
    [#assign recordsFound = searchResults?size /]

    <h3><em>${recordsFound}</em> ${i18n['search.pagesFoundFor']} "${queryStr}"</span></h3>

    <div class="list-group">
    [#if searchResults?has_content]
    [#list searchResults as item]
    <a href="${cmsfn.link(item)}" class="list-group-item">
    <h4 class="list-group-item-heading">${item.title!}</h4>
    <p class="list-group-item-text">${item.excerpt!}</p>
    </a>
    [/#list]
    [/#if]
    </div>

    <#-- More processing here, not shown in snippet >

    [/#if]


    on the workspace website I'm using a tree to create a structural site. At the moment home->main

    Thanks in advance.
    Good coding!!!

  • pedro
    pedro
    Full name: Pedro
    Posts: 11
    Last post: Sep 26, 2017 12:51:35 PM
    Registered on: Jul 27, 2017
    Re: Search returning 0 results
    #2 by pedro on Jul 27, 2017 7:39:55 PM

    PS.: Do I need to change something on magnolia.properties to use it? I'm using mysql as database so, jackrabbit-bundle-mysql-search.xml as jackrabbit.config on magnolia.properties

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/