You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Kevin Risden (JIRA)" <ji...@apache.org> on 2019/03/25 18:03:00 UTC

[jira] [Commented] (SOLR-9920) error fixes included for did_you_mean.vm and richtext_doc.vm velocity examples

    [ https://issues.apache.org/jira/browse/SOLR-9920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800941#comment-16800941 ] 

Kevin Risden commented on SOLR-9920:
------------------------------------

I fixed a few of these errors as part of SOLR-13335. Not sure I got all of them but the upgrade might have changed this as well.

>  error fixes included for did_you_mean.vm and richtext_doc.vm velocity examples
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-9920
>                 URL: https://issues.apache.org/jira/browse/SOLR-9920
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>         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
>         Attachments: jira-VELOCITY-979-bug-report.txt
>
>
> 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
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org