Hello to everyone,

I was trying to follow this 
[u][url=https://documentation.magnolia-cms.com/display/DOCS/Search]Documentation[/url][/u]
 to create a internal search engine on the template, but I can't get search 
results.

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

[code]<?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>[/code]

and modified the param [i]indexingConfiguration[/i] on 
[b]jackrabbit-memory-search.xml[/b]

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

[code][#-------------- 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][/code]

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

Thanks in advance.
Good coding!!!

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=6d2967d3-5415-4657-82b7-2e5d851ec3ef


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to