matthew grisius created VELOCITY-879:
----------------------------------------
Summary: error fixes included for did_you_mean.vm and
richtext_doc.vm velocity examples
Key: VELOCITY-879
URL: https://issues.apache.org/jira/browse/VELOCITY-879
Project: Velocity
Issue Type: Bug
Components: Scripting
Affects Versions: 1.7
Environment: 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
Reporter: matthew grisius
Priority: Trivial
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"))
## 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
## change 'content_type' to 'type', Nutch ootb default field per
https://wiki.apache.org/nutch/IndexStructure
## 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))
## delete/update this block of comments to suit maintainer. . .
## TODO: falling back to file extension is convenient,
## except when you don't have an icon for that extension
## example
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
## document with a .docx extension.
## It'd be nice to fall back to an "unknown" or the existing "file" type
## We sort of do this below, but only if the filename has no extension
## (anything after the last dot).
## if we still don't have filetype...
#if (!$filetype)
## 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
## still no filetype extension or no supported icon for extension
#if (!$filetype || !$supportedMimeTypes.contains($filetype))
#set ($filetype = "file") ## use default for unknown
#end
## could check for mere existence of a filetype file in img/ but that would
## would be an expensive dir/file read, anyway user should config
## $supportedMimeTypes and $mimeExtensionsMap properly in mime_type_lists.vm
#end
... ## Row 1: Icon and Title and mlt link
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]