http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/velocity/query_group.vm ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/velocity/query_group.vm b/contrib/solr/logs/conf/velocity/query_group.vm deleted file mode 100644 index 184eb77..0000000 --- a/contrib/solr/logs/conf/velocity/query_group.vm +++ /dev/null @@ -1,59 +0,0 @@ -#** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#** - * Query settings for grouping by fields, - * e.g.: Manufacturer or Popularity - *# - -#set($queryOpts = $params.get("queryOpts")) - -#if($queryOpts == "group") - <div> - #set($groupF = $request.params.get('group.field')) - - <label #annTitle("Add the &group.field parameter. Multiselect is supported")> - Group By: - <select id="group" name="group.field" multiple="true"> - ## TODO: Handle multiple selects correctly - ## TODO: fix empty / "No Group" selection - - <option value="" - #if($groupF == '')selected="true"#end - > - No Group - </option> - - <option value="manu_exact" - #if($groupF == 'manu_exact')selected="true"#end - > - Manufacturer - </option> - - <option value="popularity" - #if($groupF == 'popularity')selected="true"#end - > - Popularity - </option> - - </select> - </label> - - <input type="hidden" name="group" value="true"/> - - </div> - -#end
http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/velocity/query_spatial.vm ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/velocity/query_spatial.vm b/contrib/solr/logs/conf/velocity/query_spatial.vm deleted file mode 100644 index 8291bcb..0000000 --- a/contrib/solr/logs/conf/velocity/query_spatial.vm +++ /dev/null @@ -1,91 +0,0 @@ -#** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#** - * Query logic for selecting location / Geospatial search - *# - -#set($queryOpts = $params.get("queryOpts")) - -#if($queryOpts == "spatial") - - <div> - - #set($loc = $request.params.get('pt')) - ## Normalize first trip through to "none" because - ## an empty string generates an error message later on - #if( ! $loc ) - #set( $loc = "none" ) - #end - - #set($dist = $request.params.get('d', "10")) - - ## Cities for The Select List - #set( $cities = { - "none": "No Filter", - "45.17614,-93.87341": "Buffalo, MN", - "37.7752,-100.0232": "Dodge City, KS", - "35.0752,-97.032": "Oklahoma City, OK", - "37.7752,-122.4232": "San Francisco CA" - }) - - <label #annTitle("Add the &pt parameter")> - Location Filter: - <select id="pt" name="pt"> - - ## Generate <option> tag for each city - #foreach( $city_lon_lat in $cities.keySet() ) - #set( $city_name = $cities.get($city_lon_lat) ) - <option value="$city_lon_lat" - #if($loc == $city_lon_lat)selected="true"#end - > - $city_name - </option> - #end - - </select> - - </label> - - <span #annTitle("Add the &d parameter")> - Distance (KM): - <input id="d" name="d" type="text" size="6" - value="#if($dist != '')${dist}#{else}10#end" ## TODO: isn't the default of 10 above sufficient? no if/else needed? - /> - </span> - - <input type="hidden" name="sfield" value="store"/> - <input type="hidden" id="spatialFQ" name="fq" value=""/> - <input type="hidden" name="queryOpts" value="spatial"/> - - </div> - - <script type="text/javascript"> - $('#query-form').submit(function() { - if ($("#pt").val() != "none") { - $("#spatialFQ").val("{!bbox}"); - } - $fqs = $("#allFQs").val(); - $fqs = $fqs.replace("{!bbox}", ""); - if ($fqs == ''){ - $("#allFQs").remove(); - } - $("#allFQs").val($fqs); - return true; - }); - </script> - -#end http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/velocity/results_list.vm ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/velocity/results_list.vm b/contrib/solr/logs/conf/velocity/results_list.vm deleted file mode 100644 index c828ae7..0000000 --- a/contrib/solr/logs/conf/velocity/results_list.vm +++ /dev/null @@ -1,38 +0,0 @@ -#** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#** - * Render the main Results List - *# - -## Usually displayed inside <div class="results"> - -#if($response.response.get('grouped')) - - #foreach($grouping in $response.response.get('grouped')) - #parse("hit_grouped.vm") - #end - -#else - - #foreach($doc in $response.results) - #parse("hit.vm") - ## Can get an extremely simple view of the doc - ## which might be nicer for debugging - ##parse("hit_plain.vm") - #end - -#end http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/velocity/richtext_doc.vm ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/velocity/richtext_doc.vm b/contrib/solr/logs/conf/velocity/richtext_doc.vm deleted file mode 100644 index 17d0d84..0000000 --- a/contrib/solr/logs/conf/velocity/richtext_doc.vm +++ /dev/null @@ -1,169 +0,0 @@ -#** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#** - * Render a complex document in the results list - *# - -## Load Mime-Type List and Mapping -#parse('mime_type_lists.vm') -## Sets: -## * supportedMimeTypes, AKA supportedtypes -## * mimeExtensionsMap, AKA extMap - -## Title -#if($doc.getFieldValue('title')) - #set($title = $esc.html($doc.getFirstValue('title'))) -#else - #set($title = "["+$doc.getFieldValue('id')+"]") -#end - -## URL -#if($doc.getFieldValue('url')) - #set($url = $doc.getFieldValue('url')) -#elseif($doc.getFieldValue('resourcename')) - #set($url = "file:///$doc.getFieldValue('resourcename')") -#else - #set($url = "$doc.getFieldValue('id')") -#end - -## Sort out Mime-Type -#set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0)) -#set($filename = $doc.getFieldValue('resourcename')) -#set($filetype = false) -#set($filetype = $mimeExtensionsMap.get($ct)) - -## 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(!$filetype) - #set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1)) -#end - -## #if(!$filetype) -## #set($filetype = "file") -## #end -## #if(!$supportedMimeTypes.contains($filetype)) -## #set($filetype = "file") -## #end - -## Row 1: Icon and Title and mlt link -<div class="result-title"> - ## Icon - ## Small file type icons from http://www.splitbrain.org/projects/file_icons (public domain) - <img src="#{url_root}/img/filetypes/${filetype}.png" align="center"> - - ## Title, hyperlinked - <a href="${url}" target="_blank"> - <b>$title</b></a> - - ## Link for MLT / More Like This / Find Similar - <span class="mlt"> - #if($params.getBool('mlt', false) == false) - <a href="#lensNoQ&q=id:%22$docId%22&mlt=true"> - More Like This</a> - #end - </span> - -</div> - -## Row 2?: ID / URL -<div> - Id: #field('id') -</div> - -## Resource Name -<div> - #if($doc.getFieldValue('resourcename')) - Resource name: $filename - #elseif($url) - URL: $url - #end - #if($ct) - ($ct) - #end -</div> - -## Author -#if($doc.getFieldValue('author')) - <div> - Author: #field('author') - </div> -#end - -## Last_Modified Date -#if($doc.getFieldValue('last_modified')) - <div> - last-modified: - #field('last_modified') - </div> -#end - -## Main content of doc -<div class="result-body"> - #field('content') -</div> - -## Display Similar Documents / MLT = More Like This -<div class="mlt"> - #set($mlt = $mltResults.get($docId)) - #set($mltOn = $params.getBool('mlt')) - #if($mltOn == true) - <div class="field-name"> - Similar Items - </div> - #end - ## If has MLT enabled An Entries to show - #if ($mltOn && $mlt && $mlt.size() > 0) - <ul> - #foreach($mltHit in $mlt) - #set($mltId = $mltHit.getFieldValue('id')) - <li> - <div> - <a href="#url_for_home?q=id:$mltId"> - $mltId</a> - </div> - <div> - <span class="field-name"> - Title: - </span> - $mltHit.getFieldValue('title') - </div> - <div> - <span class="field-name"> - Author: - </span> - $mltHit.getFieldValue('author') - <span class="field-name"> - Description: - </span> - $mltHit.getFieldValue('description') - </div> - </li> - #end ## end for each mltHit in $mlt - </ul> - ## Else MLT Enabled but no mlt results for this query - #elseif($mltOn && $mlt.size() == 0) - <div>No Similar Items Found</div> - #end -</div> ## div class=mlt - -#parse('debug.vm') http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/velocity/suggest.vm ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/velocity/suggest.vm b/contrib/solr/logs/conf/velocity/suggest.vm deleted file mode 100644 index 5e0f22d..0000000 --- a/contrib/solr/logs/conf/velocity/suggest.vm +++ /dev/null @@ -1,24 +0,0 @@ -#** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#** - * Provides cynamic spelling suggestions - * as you type in the search form - *# - -#foreach($t in $response.response.terms.name) - $t.key -#end http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/velocity/tabs.vm ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/velocity/tabs.vm b/contrib/solr/logs/conf/velocity/tabs.vm deleted file mode 100644 index f67acfb..0000000 --- a/contrib/solr/logs/conf/velocity/tabs.vm +++ /dev/null @@ -1,66 +0,0 @@ -#** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#** - * Provides navigation/access to Advanced search options - * Usually displayed near the top of the page - *# - -##TODO: Make some nice tabs here - -#set($queryOpts = $params.get("queryOpts")) - -<div class="tabs-bar" #annTitle("Click the link to demonstrate various Solr capabilities")> - - <span>Type of Search:</span> - - ##queryOpts=$queryOpts - - ## return to Simple Search - ##set( $selected = ($queryOpts && $queryOpts != "") ) - #set( $selected = ! $queryOpts ) - <span class="tab #if($selected)selected#end"> - #if($selected) - Simple - #else - <a href="#url_for_home/?#debug#annotate"> - Simple</a> - #end - </span> - - ## GEO-Spatial / Location Based - #set( $selected = ($queryOpts == "spatial") ) - <span class="tab #if($selected)selected#end"> - #if($selected) - Spatial - #else - <a href="#url_for_home?&queryOpts=spatial#debug#annotate"> - Spatial</a> - #end - </span> - - ## Group By Field - #set( $selected = ($queryOpts == "group") ) - <span class="tab #if($selected)selected#end"> - #if($selected) - Group By - #else - <a href="#url_for_home?#debug#annotate&queryOpts=group&group=true&group.field=manu_exact"> - Group By</a> - #end - </span> - -</div> http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/xslt/example.xsl ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/xslt/example.xsl b/contrib/solr/logs/conf/xslt/example.xsl deleted file mode 100644 index b899270..0000000 --- a/contrib/solr/logs/conf/xslt/example.xsl +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> - -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - --> - -<!-- - Simple transform of Solr query results to HTML - --> -<xsl:stylesheet version='1.0' - xmlns:xsl='http://www.w3.org/1999/XSL/Transform' -> - - <xsl:output media-type="text/html" encoding="UTF-8"/> - - <xsl:variable name="title" select="concat('Solr search results (',response/result/@numFound,' documents)')"/> - - <xsl:template match='/'> - <html> - <head> - <title><xsl:value-of select="$title"/></title> - <xsl:call-template name="css"/> - </head> - <body> - <h1><xsl:value-of select="$title"/></h1> - <div class="note"> - This has been formatted by the sample "example.xsl" transform - - use your own XSLT to get a nicer page - </div> - <xsl:apply-templates select="response/result/doc"/> - </body> - </html> - </xsl:template> - - <xsl:template match="doc"> - <xsl:variable name="pos" select="position()"/> - <div class="doc"> - <table width="100%"> - <xsl:apply-templates> - <xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param> - </xsl:apply-templates> - </table> - </div> - </xsl:template> - - <xsl:template match="doc/*[@name='score']" priority="100"> - <xsl:param name="pos"></xsl:param> - <tr> - <td class="name"> - <xsl:value-of select="@name"/> - </td> - <td class="value"> - <xsl:value-of select="."/> - - <xsl:if test="boolean(//lst[@name='explain'])"> - <xsl:element name="a"> - <!-- can't allow whitespace here --> - <xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element> - <br/> - <xsl:element name="div"> - <xsl:attribute name="class">exp</xsl:attribute> - <xsl:attribute name="id"> - <xsl:value-of select="concat('exp-',$pos)" /> - </xsl:attribute> - <xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/> - </xsl:element> - </xsl:if> - </td> - </tr> - </xsl:template> - - <xsl:template match="doc/arr" priority="100"> - <tr> - <td class="name"> - <xsl:value-of select="@name"/> - </td> - <td class="value"> - <ul> - <xsl:for-each select="*"> - <li><xsl:value-of select="."/></li> - </xsl:for-each> - </ul> - </td> - </tr> - </xsl:template> - - - <xsl:template match="doc/*"> - <tr> - <td class="name"> - <xsl:value-of select="@name"/> - </td> - <td class="value"> - <xsl:value-of select="."/> - </td> - </tr> - </xsl:template> - - <xsl:template match="*"/> - - <xsl:template name="css"> - <script> - function toggle(id) { - var obj = document.getElementById(id); - obj.style.display = (obj.style.display != 'block') ? 'block' : 'none'; - } - </script> - <style type="text/css"> - body { font-family: "Lucida Grande", sans-serif } - td.name { font-style: italic; font-size:80%; } - td { vertical-align: top; } - ul { margin: 0px; margin-left: 1em; padding: 0px; } - .note { font-size:80%; } - .doc { margin-top: 1em; border-top: solid grey 1px; } - .exp { display: none; font-family: monospace; white-space: pre; } - </style> - </xsl:template> - -</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/xslt/example_atom.xsl ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/xslt/example_atom.xsl b/contrib/solr/logs/conf/xslt/example_atom.xsl deleted file mode 100644 index b6c2315..0000000 --- a/contrib/solr/logs/conf/xslt/example_atom.xsl +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> - -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - --> - -<!-- - Simple transform of Solr query results to Atom - --> - -<xsl:stylesheet version='1.0' - xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> - - <xsl:output - method="xml" - encoding="utf-8" - media-type="application/xml" - /> - - <xsl:template match='/'> - <xsl:variable name="query" select="response/lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/> - <feed xmlns="http://www.w3.org/2005/Atom"> - <title>Example Solr Atom 1.0 Feed</title> - <subtitle> - This has been formatted by the sample "example_atom.xsl" transform - - use your own XSLT to get a nicer Atom feed. - </subtitle> - <author> - <name>Apache Solr</name> - <email>[email protected]</email> - </author> - <link rel="self" type="application/atom+xml" - href="http://localhost:8983/solr/q={$query}&wt=xslt&tr=atom.xsl"/> - <updated> - <xsl:value-of select="response/result/doc[position()=1]/date[@name='timestamp']"/> - </updated> - <id>tag:localhost,2007:example</id> - <xsl:apply-templates select="response/result/doc"/> - </feed> - </xsl:template> - - <!-- search results xslt --> - <xsl:template match="doc"> - <xsl:variable name="id" select="str[@name='id']"/> - <entry> - <title><xsl:value-of select="str[@name='name']"/></title> - <link href="http://localhost:8983/solr/select?q={$id}"/> - <id>tag:localhost,2007:<xsl:value-of select="$id"/></id> - <summary><xsl:value-of select="arr[@name='features']"/></summary> - <updated><xsl:value-of select="date[@name='timestamp']"/></updated> - </entry> - </xsl:template> - -</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/xslt/example_rss.xsl ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/xslt/example_rss.xsl b/contrib/solr/logs/conf/xslt/example_rss.xsl deleted file mode 100644 index 2857f11..0000000 --- a/contrib/solr/logs/conf/xslt/example_rss.xsl +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> - -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - --> - -<!-- - Simple transform of Solr query results to RSS - --> - -<xsl:stylesheet version='1.0' - xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> - - <xsl:output - method="xml" - encoding="utf-8" - media-type="application/xml" - /> - <xsl:template match='/'> - <rss version="2.0"> - <channel> - <title>Example Solr RSS 2.0 Feed</title> - <link>http://localhost:8983/solr</link> - <description> - This has been formatted by the sample "example_rss.xsl" transform - - use your own XSLT to get a nicer RSS feed. - </description> - <language>en-us</language> - <docs>http://localhost:8983/solr</docs> - <xsl:apply-templates select="response/result/doc"/> - </channel> - </rss> - </xsl:template> - - <!-- search results xslt --> - <xsl:template match="doc"> - <xsl:variable name="id" select="str[@name='id']"/> - <xsl:variable name="timestamp" select="date[@name='timestamp']"/> - <item> - <title><xsl:value-of select="str[@name='name']"/></title> - <link> - http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/> - </link> - <description> - <xsl:value-of select="arr[@name='features']"/> - </description> - <pubDate><xsl:value-of select="$timestamp"/></pubDate> - <guid> - http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/> - </guid> - </item> - </xsl:template> -</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/xslt/luke.xsl ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/xslt/luke.xsl b/contrib/solr/logs/conf/xslt/luke.xsl deleted file mode 100644 index 8553f3c..0000000 --- a/contrib/solr/logs/conf/xslt/luke.xsl +++ /dev/null @@ -1,337 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - - -<!-- - Display the luke request handler with graphs - --> -<xsl:stylesheet - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns="http://www.w3.org/1999/xhtml" - version="1.0" - > - <xsl:output - method="html" - encoding="UTF-8" - media-type="text/html" - doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" - doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" - /> - - <xsl:variable name="title">Solr Luke Request Handler Response</xsl:variable> - - <xsl:template match="/"> - <html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <link rel="stylesheet" type="text/css" href="solr-admin.css"/> - <link rel="icon" href="favicon.ico" type="image/ico"/> - <link rel="shortcut icon" href="favicon.ico" type="image/ico"/> - <title> - <xsl:value-of select="$title"/> - </title> - <xsl:call-template name="css"/> - - </head> - <body> - <h1> - <xsl:value-of select="$title"/> - </h1> - <div class="doc"> - <ul> - <xsl:if test="response/lst[@name='index']"> - <li> - <a href="#index">Index Statistics</a> - </li> - </xsl:if> - <xsl:if test="response/lst[@name='fields']"> - <li> - <a href="#fields">Field Statistics</a> - <ul> - <xsl:for-each select="response/lst[@name='fields']/lst"> - <li> - <a href="#{@name}"> - <xsl:value-of select="@name"/> - </a> - </li> - </xsl:for-each> - </ul> - </li> - </xsl:if> - <xsl:if test="response/lst[@name='doc']"> - <li> - <a href="#doc">Document statistics</a> - </li> - </xsl:if> - </ul> - </div> - <xsl:if test="response/lst[@name='index']"> - <h2><a name="index"/>Index Statistics</h2> - <xsl:apply-templates select="response/lst[@name='index']"/> - </xsl:if> - <xsl:if test="response/lst[@name='fields']"> - <h2><a name="fields"/>Field Statistics</h2> - <xsl:apply-templates select="response/lst[@name='fields']"/> - </xsl:if> - <xsl:if test="response/lst[@name='doc']"> - <h2><a name="doc"/>Document statistics</h2> - <xsl:apply-templates select="response/lst[@name='doc']"/> - </xsl:if> - </body> - </html> - </xsl:template> - - <xsl:template match="lst"> - <xsl:if test="parent::lst"> - <tr> - <td colspan="2"> - <div class="doc"> - <xsl:call-template name="list"/> - </div> - </td> - </tr> - </xsl:if> - <xsl:if test="not(parent::lst)"> - <div class="doc"> - <xsl:call-template name="list"/> - </div> - </xsl:if> - </xsl:template> - - <xsl:template name="list"> - <xsl:if test="count(child::*)>0"> - <table> - <thead> - <tr> - <th colspan="2"> - <p> - <a name="{@name}"/> - </p> - <xsl:value-of select="@name"/> - </th> - </tr> - </thead> - <tbody> - <xsl:choose> - <xsl:when - test="@name='histogram'"> - <tr> - <td colspan="2"> - <xsl:call-template name="histogram"/> - </td> - </tr> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates/> - </xsl:otherwise> - </xsl:choose> - </tbody> - </table> - </xsl:if> - </xsl:template> - - <xsl:template name="histogram"> - <div class="doc"> - <xsl:call-template name="barchart"> - <xsl:with-param name="max_bar_width">50</xsl:with-param> - <xsl:with-param name="iwidth">800</xsl:with-param> - <xsl:with-param name="iheight">160</xsl:with-param> - <xsl:with-param name="fill">blue</xsl:with-param> - </xsl:call-template> - </div> - </xsl:template> - - <xsl:template name="barchart"> - <xsl:param name="max_bar_width"/> - <xsl:param name="iwidth"/> - <xsl:param name="iheight"/> - <xsl:param name="fill"/> - <xsl:variable name="max"> - <xsl:for-each select="int"> - <xsl:sort data-type="number" order="descending"/> - <xsl:if test="position()=1"> - <xsl:value-of select="."/> - </xsl:if> - </xsl:for-each> - </xsl:variable> - <xsl:variable name="bars"> - <xsl:value-of select="count(int)"/> - </xsl:variable> - <xsl:variable name="bar_width"> - <xsl:choose> - <xsl:when test="$max_bar_width < ($iwidth div $bars)"> - <xsl:value-of select="$max_bar_width"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$iwidth div $bars"/> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <table class="histogram"> - <tbody> - <tr> - <xsl:for-each select="int"> - <td> - <xsl:value-of select="."/> - <div class="histogram"> - <xsl:attribute name="style">background-color: <xsl:value-of select="$fill"/>; width: <xsl:value-of select="$bar_width"/>px; height: <xsl:value-of select="($iheight*number(.)) div $max"/>px;</xsl:attribute> - </div> - </td> - </xsl:for-each> - </tr> - <tr> - <xsl:for-each select="int"> - <td> - <xsl:value-of select="@name"/> - </td> - </xsl:for-each> - </tr> - </tbody> - </table> - </xsl:template> - - <xsl:template name="keyvalue"> - <xsl:choose> - <xsl:when test="@name"> - <tr> - <td class="name"> - <xsl:value-of select="@name"/> - </td> - <td class="value"> - <xsl:value-of select="."/> - </td> - </tr> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="."/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template match="int|bool|long|float|double|uuid|date"> - <xsl:call-template name="keyvalue"/> - </xsl:template> - - <xsl:template match="arr"> - <tr> - <td class="name"> - <xsl:value-of select="@name"/> - </td> - <td class="value"> - <ul> - <xsl:for-each select="child::*"> - <li> - <xsl:apply-templates/> - </li> - </xsl:for-each> - </ul> - </td> - </tr> - </xsl:template> - - <xsl:template match="str"> - <xsl:choose> - <xsl:when test="@name='schema' or @name='index' or @name='flags'"> - <xsl:call-template name="schema"/> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="keyvalue"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template name="schema"> - <tr> - <td class="name"> - <xsl:value-of select="@name"/> - </td> - <td class="value"> - <xsl:if test="contains(.,'unstored')"> - <xsl:value-of select="."/> - </xsl:if> - <xsl:if test="not(contains(.,'unstored'))"> - <xsl:call-template name="infochar2string"> - <xsl:with-param name="charList"> - <xsl:value-of select="."/> - </xsl:with-param> - </xsl:call-template> - </xsl:if> - </td> - </tr> - </xsl:template> - - <xsl:template name="infochar2string"> - <xsl:param name="i">1</xsl:param> - <xsl:param name="charList"/> - - <xsl:variable name="char"> - <xsl:value-of select="substring($charList,$i,1)"/> - </xsl:variable> - <xsl:choose> - <xsl:when test="$char='I'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='I']"/> - </xsl:when> - <xsl:when test="$char='T'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='T']"/> - </xsl:when> - <xsl:when test="$char='S'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='S']"/> - </xsl:when> - <xsl:when test="$char='M'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='M']"/> - </xsl:when> - <xsl:when test="$char='V'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='V']"/> - </xsl:when> - <xsl:when test="$char='o'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='o']"/> - </xsl:when> - <xsl:when test="$char='p'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='p']"/> - </xsl:when> - <xsl:when test="$char='O'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='O']"/> - </xsl:when> - <xsl:when test="$char='L'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='L']"/> - </xsl:when> - <xsl:when test="$char='B'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='B']"/> - </xsl:when> - <xsl:when test="$char='C'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='C']"/> - </xsl:when> - <xsl:when test="$char='f'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='f']"/> - </xsl:when> - <xsl:when test="$char='l'"> - <xsl:value-of select="/response/lst[@name='info']/lst/str[@name='l']"/> - - </xsl:when> - </xsl:choose> - - <xsl:if test="not($i>=string-length($charList))"> - <xsl:call-template name="infochar2string"> - <xsl:with-param name="i"> - <xsl:value-of select="$i+1"/> - </xsl:with-param> - <xsl:with-param name="charList"> - <xsl:value-of select="$charList"/> - </xsl:with-param> - </xsl:call-template> - </xsl:if> - </xsl:template> - <xsl:template name="css"> - <style type="text/css"> - <![CDATA[ - td.name {font-style: italic; font-size:80%; } - .doc { margin: 0.5em; border: solid grey 1px; } - .exp { display: none; font-family: monospace; white-space: pre; } - div.histogram { background: none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;} - table.histogram { width: auto; vertical-align: bottom; } - table.histogram td, table.histogram th { text-align: center; vertical-align: bottom; border-bottom: 1px solid #ff9933; width: auto; } - ]]> - </style> - </xsl:template> -</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/conf/xslt/updateXml.xsl ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/conf/xslt/updateXml.xsl b/contrib/solr/logs/conf/xslt/updateXml.xsl deleted file mode 100644 index daf1344..0000000 --- a/contrib/solr/logs/conf/xslt/updateXml.xsl +++ /dev/null @@ -1,70 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - --> - -<!-- - Simple transform of Solr query response into Solr Update XML compliant XML. - When used in the xslt response writer you will get UpdaateXML as output. - But you can also store a query response XML to disk and feed this XML to - the XSLTUpdateRequestHandler to index the content. Provided as example only. - See http://wiki.apache.org/solr/XsltUpdateRequestHandler for more info - --> -<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> - <xsl:output media-type="text/xml" method="xml" indent="yes"/> - - <xsl:template match='/'> - <add> - <xsl:apply-templates select="response/result/doc"/> - </add> - </xsl:template> - - <!-- Ignore score (makes no sense to index) --> - <xsl:template match="doc/*[@name='score']" priority="100"> - </xsl:template> - - <xsl:template match="doc"> - <xsl:variable name="pos" select="position()"/> - <doc> - <xsl:apply-templates> - <xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param> - </xsl:apply-templates> - </doc> - </xsl:template> - - <!-- Flatten arrays to duplicate field lines --> - <xsl:template match="doc/arr" priority="100"> - <xsl:variable name="fn" select="@name"/> - - <xsl:for-each select="*"> - <xsl:element name="field"> - <xsl:attribute name="name"><xsl:value-of select="$fn"/></xsl:attribute> - <xsl:value-of select="."/> - </xsl:element> - </xsl:for-each> - </xsl:template> - - - <xsl:template match="doc/*"> - <xsl:variable name="fn" select="@name"/> - - <xsl:element name="field"> - <xsl:attribute name="name"><xsl:value-of select="$fn"/></xsl:attribute> - <xsl:value-of select="."/> - </xsl:element> - </xsl:template> - - <xsl:template match="*"/> -</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/contrib/solr/logs/core.properties ---------------------------------------------------------------------- diff --git a/contrib/solr/logs/core.properties b/contrib/solr/logs/core.properties deleted file mode 100644 index 726e1ac..0000000 --- a/contrib/solr/logs/core.properties +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -name=logs http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java b/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java index 40a6ff0..30d452c 100644 --- a/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java +++ b/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java @@ -36,6 +36,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.log4j.Logger; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudSolrServer; +import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrInputDocument; public class SolrWriter extends PipelineableWriter { @@ -77,6 +78,9 @@ public class SolrWriter extends PipelineableWriter { @Override public CommitStatus add(List<Chunk> chunks) throws WriterException { + if(server == null) { + init(ChukwaAgent.getStaticConfiguration()); + } CommitStatus rv = ChukwaWriter.COMMIT_OK; for(Chunk chunk : chunks) { try { @@ -94,18 +98,19 @@ public class SolrWriter extends PipelineableWriter { Matcher m = userPattern.matcher(data); if(m.find()) { doc.addField(USER, m.group(1)); + } else { + doc.addField(USER, "Unclassified"); } if(data.contains("hdfs")) { doc.addField(SERVICE, "hdfs"); - } - if(data.contains("yarn")) { + } else if(data.contains("yarn")) { doc.addField(SERVICE, "yarn"); - } - if(data.contains("mapredice")) { + } else if(data.contains("mapredice")) { doc.addField(SERVICE, "mapreduce"); - } - if(data.contains("hbase")) { + } else if(data.contains("hbase")) { doc.addField(SERVICE, "hbase"); + } else { + doc.addField(SERVICE, "Unclassified"); } try { Date d = sdf.parse(data); @@ -114,11 +119,19 @@ public class SolrWriter extends PipelineableWriter { } server.add(doc); - server.commit(); - } catch (SolrServerException | IOException e) { + } catch (Exception e) { log.warn("Failed to store data to Solr Cloud."); log.warn(ExceptionUtil.getStackTrace(e)); + server = null; + } + } + try { + if(server != null) { + server.commit(); } + } catch (Exception e) { + log.warn("Failed to store data to Solr Cloud."); + log.warn(ExceptionUtil.getStackTrace(e)); } if (next != null) { rv = next.add(chunks); //pass data through http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/src/main/web/hicc/ajax-solr/chukwa/js/logsearch.js ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/ajax-solr/chukwa/js/logsearch.js b/src/main/web/hicc/ajax-solr/chukwa/js/logsearch.js index b3175dd..c35cfcb 100644 --- a/src/main/web/hicc/ajax-solr/chukwa/js/logsearch.js +++ b/src/main/web/hicc/ajax-solr/chukwa/js/logsearch.js @@ -43,7 +43,7 @@ define([ $(function () { Manager = new AjaxSolr.Manager({ - solrUrl: '/hicc/solr/logs/' + solrUrl: '/hicc/solr/chukwa/' }); Manager.addWidget(new AjaxSolr.ResultWidget({ id: 'result', http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/src/main/web/hicc/ajax-solr/chukwa/js/logviewer.js ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/ajax-solr/chukwa/js/logviewer.js b/src/main/web/hicc/ajax-solr/chukwa/js/logviewer.js index 971abba..ed79af6 100644 --- a/src/main/web/hicc/ajax-solr/chukwa/js/logviewer.js +++ b/src/main/web/hicc/ajax-solr/chukwa/js/logviewer.js @@ -48,7 +48,7 @@ function getLog(type, startDate, direction) { } console.log(q); $.ajax({ - url: '/hicc/solr/logs/select', + url: '/hicc/solr/chukwa/select', data: { q: q, wt: "json", http://git-wip-us.apache.org/repos/asf/chukwa/blob/21b24284/src/test/java/org/apache/hadoop/chukwa/datacollection/writer/solr/TestSolrWriter.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/hadoop/chukwa/datacollection/writer/solr/TestSolrWriter.java b/src/test/java/org/apache/hadoop/chukwa/datacollection/writer/solr/TestSolrWriter.java index 7b6ff60..ba75e85 100644 --- a/src/test/java/org/apache/hadoop/chukwa/datacollection/writer/solr/TestSolrWriter.java +++ b/src/test/java/org/apache/hadoop/chukwa/datacollection/writer/solr/TestSolrWriter.java @@ -33,6 +33,7 @@ import junit.framework.Assert; public class TestSolrWriter extends SolrJettyTestBase { private static Logger log = Logger.getLogger(TestSolrWriter.class); + private static EmbeddedSolrServer server; CoreContainer container; public void setUp() {
