Kaynağa Gözat

[search] Initial commit

Very simple UI for submitting a query to an already running Solr example
Romain Rigaux 13 yıl önce
ebeveyn
işleme
bac447f290

+ 4 - 2
apps/Makefile

@@ -42,7 +42,8 @@ APPS := about \
   shell \
   useradmin \
   impala \
-  pig
+  pig \
+  search
 
 ################################################
 # Install all applications into the Desktop environment
@@ -113,7 +114,8 @@ I18N_APPS := about \
   useradmin \
   oozie \
   impala \
-  pig
+  pig \
+  search
 
 COMPILE_LOCALE_TARGETS := $(I18N_APPS:%=.recursive-compile-locales/%)
 compile-locales: $(COMPILE_LOCALE_TARGETS)

+ 24 - 0
apps/search/Makefile

@@ -0,0 +1,24 @@
+#
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+#
+
+ifeq ($(ROOT),)
+  $(error "Error: Expect the environment variable $$ROOT to point to the Desktop installation")
+endif
+
+APP_NAME = search
+include $(ROOT)/Makefile.sdk

+ 2 - 0
apps/search/babel.cfg

@@ -0,0 +1,2 @@
+[python: src/search/**.py]
+[mako: src/search/templates/**.mako]

+ 20 - 0
apps/search/hueversion.py

@@ -0,0 +1,20 @@
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+#
+# This file should be the one source of truth for for versions within HUE.
+# It is at least included by each of the default hue app's setup.py.
+
+VERSION="2.1.0"

+ 29 - 0
apps/search/setup.py

@@ -0,0 +1,29 @@
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+from setuptools import setup, find_packages
+from hueversion import VERSION
+
+setup(
+      name = "search",
+      version = VERSION,
+      author = "Hue",
+      url = 'http://github.com/cloudera/hue',
+      description = "Search all your Big Data",
+      packages = find_packages('src'),
+      package_dir = {'': 'src'},
+      install_requires = ['setuptools', 'desktop'],
+      entry_points = { 'desktop.sdk.application': 'search=search' },
+)

+ 15 - 0
apps/search/src/search/__init__.py

@@ -0,0 +1,15 @@
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.

+ 23 - 0
apps/search/src/search/forms.py

@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+
+from django import forms
+
+
+class QueryForm(forms.Form):
+  query = forms.CharField(label="", max_length=256, required=False, widget=forms.TextInput(attrs={'class': 'input-xlarge'}))

+ 35 - 0
apps/search/src/search/locale/de/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# German translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: de <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "Über Hue"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "Konfiguration"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "Auf Fehlkonfiguration prüfen"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "Server-Protokolle"
+

+ 35 - 0
apps/search/src/search/locale/en_US.pot

@@ -0,0 +1,35 @@
+# Translations template for Hue.
+# Copyright (C) 2012 Cloudera, Inc
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: Hue VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr ""
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr ""
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr ""
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr ""
+

+ 35 - 0
apps/search/src/search/locale/en_US.pot~

@@ -0,0 +1,35 @@
+# Translations template for Hue.
+# Copyright (C) 2012 Cloudera, Inc
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: Hue VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-07-31 11:34-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr ""
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr ""
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr ""
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr ""
+

+ 35 - 0
apps/search/src/search/locale/es/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# Spanish translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: es <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "Acerca de Hue"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "Configuración"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "Comprobar error de configuración"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "Registros del servidor"
+

+ 35 - 0
apps/search/src/search/locale/fr/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# French translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: fr <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n > 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "A propos de Hue"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "Configuration"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "Recherche de configuration incorrecte"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "Journaux de serveur"
+

+ 35 - 0
apps/search/src/search/locale/ja/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# Japanese translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: ja <LL@li.org>\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "Hue のバージョン情報"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "設定"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "誤設定がないか確認します"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "サーバーログ"
+

+ 35 - 0
apps/search/src/search/locale/ko/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# Korean translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: ko <LL@li.org>\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "Hue 정보"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "구성"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "잘못된 구성 검사"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "서버 로그"
+

+ 35 - 0
apps/search/src/search/locale/pt/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# Portuguese translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: pt <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "Acerca da Hue"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "Configuração"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "Verifique se a configuração está correcta"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "Registos do servidor"
+

+ 35 - 0
apps/search/src/search/locale/pt_BR/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# Portuguese (Brazil) translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: pt_BR <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n > 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "Sobre o Hue"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "Configuração"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "Verificar configurações incorretas"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "Logs de servidor"
+

+ 35 - 0
apps/search/src/search/locale/zh_CN/LC_MESSAGES/django.po

@@ -0,0 +1,35 @@
+# Chinese (China) translations for Hue.
+# Copyright (C) 2012 Cloudera
+# This file is distributed under the same license as the Hue project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-09-11 13:35-0700\n"
+"PO-Revision-Date: 2012-07-30 18:50-0700\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: zh_CN <LL@li.org>\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/about/templates/index.mako:20
+msgid "About Hue"
+msgstr "关于 Hue"
+
+#: src/about/templates/index.mako:25
+msgid "Configuration"
+msgstr "配置"
+
+#: src/about/templates/index.mako:26
+msgid "Check for misconfiguration"
+msgstr "检查错误配置"
+
+#: src/about/templates/index.mako:27
+msgid "Server Logs"
+msgstr "服务器日志"
+

+ 22 - 0
apps/search/src/search/settings.py

@@ -0,0 +1,22 @@
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+DJANGO_APPS = [ "search" ]
+NICE_NAME = "Search"
+MENU_INDEX = 42
+ICON = "/search/static/art/icon_search_24.png"
+
+REQUIRES_HADOOP = False
+IS_URL_NAMESPACED = True

+ 75 - 0
apps/search/src/search/templates/index.mako

@@ -0,0 +1,75 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. 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.
+<%!
+from desktop.views import commonheader, commonfooter
+from django.utils.translation import ugettext as _
+%>
+
+${ commonheader(_('Search'), "search", "100px") }
+
+
+##<div class="subnav subnav-fixed">
+##  <div class="container-fluid">
+##    <ul class="nav nav-pills">
+##	  <li><a href="">${_('Configuration')}</a></li>
+##    </ul>
+##  </div>
+##</div>
+
+<div class="container-fluid">
+  <h1>Search</h1>
+  <div class="row-fluid">    
+    <div class="span2"></div>
+    <div class="span8">
+      <form class="form-search">
+         ${ search_form }
+       <button class="btn" type="submit">Search</button>
+      </form>
+    </div>
+    <div class="span2">(query example: solr)</div>
+  </div>
+</div>
+
+% if response:
+<div class="container-fluid">
+  <div class="row-fluid">
+    <div class="span2"></div>
+    <div class="span8">
+      % for result in response['response']['docs']:
+        <div class="row-fluid">
+          <div class="span2">${ result.get('id', '') }</div>
+          <div class="span6">${ result.get('name', '') }</div>
+        </div>
+      % endfor
+    </div>
+    <div class="span2"></div>
+  </div>
+  
+  <div class="row-fluid">
+    <div class="span2"></div>
+    <div class="span8">  
+      Result founds: ${ response['response']['numFound'] }
+     </div>
+    <div class="span2"></div>
+  </div> 
+  
+  <div class="row-fluid"> 
+      ${ response }
+  </div>  
+</div>
+% endif
+
+${ commonfooter(messages) }

+ 23 - 0
apps/search/src/search/urls.py

@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+from django.conf.urls.defaults import patterns, url
+
+urlpatterns = patterns('search.views',
+  url(r'^$', 'index', name='index'),
+  url(r'^query$', 'index', name='query')
+)

+ 57 - 0
apps/search/src/search/views.py

@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
+try:
+  import json
+except ImportError:
+  import simplejson as json
+import logging
+
+from desktop.lib.django_util import render
+
+from search.forms import QueryForm
+from desktop.lib.rest.http_client import HttpClient
+from desktop.lib.rest.resource import Resource
+
+
+# http://lucene.apache.org/solr/api-4_0_0-BETA/doc-files/tutorial.html#Getting+Started
+SOLR_URL = 'http://localhost:8983/solr/'
+
+LOG = logging.getLogger(__name__)
+
+
+def index(request):
+  search_form = QueryForm(request.GET)
+  response = {}
+  
+  if search_form.is_valid():
+    response = SolrApi(SOLR_URL).query(search_form.cleaned_data['query'])
+    response = json.loads(response)
+
+  return render('index.mako', request, {'search_form': search_form, 'response': response})
+
+
+
+# Simple API for now 
+class SolrApi(object):
+  def __init__(self, solr_url):
+    self._url = solr_url
+    self._client = HttpClient(self._url, logger=LOG)
+    self._root = Resource(self._client)
+
+  def query(self, query):    
+    return self._root.get('collection1/select', {'q': query, 'wt': 'json'})

BIN
apps/search/static/art/icon_search_24.png


+ 3 - 0
apps/search/static/help/index.html

@@ -0,0 +1,3 @@
+<html>
+<h1><a name="AboutHue-AboutHue"></a>About Search</h1>
+</html>