Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Henrik Ladefoged 30 posts 100 karma points
    Feb 08, 2016 @ 13:45
    Henrik Ladefoged
    0

    Examine: Searchindex returns no results despite containing 504 documents

    <add name="PDFIndexer" type="UmbracoExamine.PDF.PDFIndexer, UmbracoExamine.PDF" extensions=".pdf" umbracoFileProperty="File"/>
    

    I got a pdf specific index up and running but no matter what i search for it return " ".

    I tried rebuilding the index several times to no avail.

    My xslt code:

    <xsl:variable name="pdfresult" select="Examine:SearchContentOnly($searchTerm,true(),'PDFSearcher')" />
    
  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Feb 08, 2016 @ 13:49
    Chriztian Steinmeier
    0

    Hi Henrik,

    I haven't tried any Examine stuff, but I noticed thath you named the index PDFIndexer, yet the name you're passing into the extension is PDFSearcher ?

    (I could be missing a mapping somewhere - just wanted to point it out, though).

    /Chriztian

  • Henrik Ladefoged 30 posts 100 karma points
    Feb 08, 2016 @ 13:56
    Henrik Ladefoged
    0

    Hi Chriztian

    Changing from search to indexer returns the following error:

    System.NotSupportedException: XSLT Extensions are only support for providers of type LuceneSearcher 
    at UmbracoExamine.XsltExtensions.EnsureProvider(BaseSearchProvider p) 
    at UmbracoExamine.XsltExtensions.Search(String searchText, Boolean useWildcards, String providerName, String indexType)
    

    The complete xslt code for reference:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umb="urn:umbraco.library" 
      xmlns:search="urn:Illumi.Search"
      xmlns:Examine="urn:Examine"
      exclude-result-prefixes="msxml Examine umb search">
    
      <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
      <xsl:param name="currentPage"/>
    
      <xsl:variable name="searchTerm" select="umb:Request('s')" /> 
      <xsl:variable name="result" select="search:Search($searchTerm,'bodyText,header,teaser,metaTitle,metaDescription','BorneraadetContentIndexer','wildcard','1.0')" />
      <xsl:variable name="pdfresult" select="Examine:SearchContentOnly($searchTerm,true(),'PDFIndexer')" />
    
      <xsl:key name="document-by-id" match="*[@isDoc]" use="@id" />
    
     <xsl:template match="/">
        <textarea><xsl:copy-of select="$pdfresult" /></textarea>
        <xsl:apply-templates select="$currentPage" />
      </xsl:template>
    
      <xsl:template match="BorneraadetSearchResult">
        <article class="search-result">
          <h1><xsl:value-of select="header" /></h1>
          <xsl:if test="normalize-space(teaser)">
            <h2>
              <xsl:value-of select="umb:ReplaceLineBreaks(teaser)" disable-output-escaping="yes" />
            </h2>
          </xsl:if>
          <xsl:value-of select="umb:RenderMacroContent(bodyText, @id)" disable-output-escaping="yes" />
          <xsl:apply-templates select="$result" mode="result" />
        </article>
      </xsl:template>
    
      <xsl:template match="Results[normalize-space(Result)]" mode="result">
        <p>
          Du har søgt på: <strong><xsl:value-of select="umb:Request('s')" /></strong> og det gav <strong><xsl:value-of select="count(Result)" /></strong> resultat(er)
        </p>
        <ul class="searchResult">
          <xsl:apply-templates select="Result" />
        </ul>
      </xsl:template>
    
      <xsl:template match="Results[not(normalize-space(Result))]" mode="result">
        <p>
          Du har søgt på: <strong><xsl:value-of select="umb:Request('s')" /></strong> og det gav <strong>ingen</strong> resultater
        </p>
      </xsl:template>
    
      <xsl:template match="Result">
        <xsl:variable name="content">
          <xsl:choose>
            <xsl:when test="normalize-space(Field[@Name='teaser'])">
              <xsl:value-of select="Field[@Name='teaser']" />
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="Field[@Name='bodyText']" />
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
    
        <li>
        <em class="searchdate"><xsl:value-of select="umb:FormatDateTime(Field[@Name='updateDate'], 'd. MMMM, yyyy')" /></em>
          <a href="{umb:NiceUrl(@Id)}">
            <xsl:choose>
              <xsl:when test="normalize-space(Field[@Name='header'])">
                <strong><xsl:value-of select="Field[@Name='header']" /></strong>
              </xsl:when>
              <xsl:otherwise>
                <strong><xsl:value-of select="Field[@Name='nodeName']" /></strong>
              </xsl:otherwise>
            </xsl:choose>
          </a>
          <p>
            <xsl:value-of select="normalize-space(umb:TruncateString(umb:Replace($content, '&nbsp;', ''), 205, '&#8230;'))" />
          </p>
        </li>
      </xsl:template>
    
    </xsl:stylesheet>
    
  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 08, 2016 @ 14:13
    Ismail Mayat
    1

    To search you need PDFSearcher not indexer that is used during indexing time. I am assuming you have written your own xslt extension under Illumi.Search which is what you are calling? If so can you put debugger using visual studio on method SearchContentOnly then can you paste back actual lucene query generated.

    Just to be aware Pdf content lives in field called FileTextContent are you definitely searching on that field?

    Regards

    Ismail

  • Henrik Ladefoged 30 posts 100 karma points
    Mar 04, 2016 @ 12:26
    Henrik Ladefoged
    0

    Thanks you all for helping.

    Using the "FileTextContent" fieldname solved the problem.

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft