Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9920

error fixes included for did_you_mean.vm and richtext_doc.vm velocity examples

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • openSUSE leap42.2, Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode), Solr 6.3.0 includes lucene 6.30 which includes velocity

    Description

      fixes included for velocity examples 1) did_you_mean.vm 2) and richtext_doc.vm

      1) did_you_mean.vm - java ERROR in log get .size of null value
      #**

      • Hyperlinked spelling suggestions in results list
        *#
        #set($collations = $response.response.spellcheck.collations.getAll("collation"))
        1. make sure we get a non-null result before checking size . . .
          #if($collations && $collations.size() > 0)
          Did you mean
          #foreach($collation in $collations)
          <a href="# {url_for_home}

          #

          {lensNoQ}

          &q=$esc.url($collation.collationQuery)">$esc.html($collation.collationQuery)</a> ($collation.hits)?
          #end
          #end

      2) richtext_doc.vm - Mime-Type/filetype mapping to reasonable display icon

      replace everything between line from: "## Sort out Mime-Type"
      to line "## Row 1: Icon and Title and mlt link" with:

      ... ## Sort out Mime-Type

        1. change 'content_type' to 'type', Nutch ootb default field per https://wiki.apache.org/nutch/IndexStructure
        2. should change other Nutch/Solr config files too, e.g. schema.xml or managed_schema . . .
          #set($ct = $list.get($doc.getFirstValue('type').split(";"),0))
          #set($filename = $doc.getFieldValue('resourcename'))
          #set($filetype = false)
          #set($filetype = $mimeExtensionsMap.get($ct))
        1. delete/update this block of comments to suit maintainer. . .
        2. TODO: falling back to file extension is convenient,
        3. except when you don't have an icon for that extension
        4. example "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
        5. document with a .docx extension.
        6. It'd be nice to fall back to an "unknown" or the existing "file" type
        7. We sort of do this below, but only if the filename has no extension
        8. (anything after the last dot).
        1. if we still don't have filetype...
          #if (!$filetype)
        2. get file extension if any
          #set ($dot = $url.lastIndexOf("."))
          #if ($dot > 0) ## ok, found a '.'
          #set ($dot = $dot + 1) ## move past it
          #set ($filetype = $url.substring($dot))
          #end
        3. still no filetype extension or no supported icon for extension
          #if (!$filetype || !$supportedMimeTypes.contains($filetype))
          #set ($filetype = "file") ## use default for unknown
          #end
        4. could check for mere existence of a filetype file in img/ but that would
        5. would be an expensive dir/file read, anyway user should config
        6. $supportedMimeTypes and $mimeExtensionsMap properly in mime_type_lists.vm
          #end

      ... ## Row 1: Icon and Title and mlt link

      Attachments

        1. jira-VELOCITY-979-bug-report.txt
          2 kB
          matthew grisius

        Issue Links

          Activity

            People

              Unassigned Unassigned
              matthew.grisius matthew grisius
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: