ruby on rails から solrの検索をできるようにしたい。その道のりを書いていこうと。

Apache Solr 1.4 をインストールする環境

wget http://ftp.riken.jp/net/apache/lucene/solr/1.4.0/apache-solr-1.4.0.tgz -O - | tar xzvf -
cd apache-solr-1.4.0/example/
java -jar start.jar

http://localhost:8983/solr/admin/ でSolrの管理ページが表示されればOK。

solr 1.4 で PDFを検索させたい・・

久しぶりのエントリー

solrが1.4になってPDFやWordも検索対象にさせることができるようになったということで試してみようと思ったのだけど、どうやるのやら。。

http://wiki.apache.org/solr/ExtractingRequestHandler : 本家Wiki ExtractingRequestHandler

あたりかなあ。サンプルで flare (RoRで作ったSolrクライアント) + Solrは簡単にできた。

http://www.rondhuit.com/download/RONDHUIT-REPORT-Vol2.pdf : 10分で簡単! RailsとSolrの全文検索デモ構築

  • コンセプトメイク
    • 低レベルモジュールの積み上げ
    • サイト毎のviewの切り替え
    • テーブルの互換性維持
    • テーブルのサイト毎切り替え方法
  • ローカル環境構築手順
    • 短時間にできる方法
  • 新規モジュール追加手順
    • pasterのコマンドとして追加
  • 本番サーバ展開手順
    • 負荷分散サーバへの展開とかapacheとの連携とか
  • 追加開発機能
    • 端末判定機能
    • キャリア接続機能
    • ダウンロード
  • はまりポイントの解消

bazaarはじめました

新規プロジェクトでbazaar使ってみようかと画策。
そこでまずは会社の鯖にbzrがあるかどうか試したがなかった。

インストールしようにも会社の鯖にroot権限がないのでBazaar User Guide — Bazaar 2.8.0dev1 documentationを参考にソースから$HOME/binに構築することに。

InstallationFaq - wiki.bazaar.canonical.comによるとElementTreeパッケージが強くお勧めとのことなので、最初から同梱されているpython2.5を使うことを決心。

ところが鯖のデフォルトはpython2.4 orz。ローカルにhttp://labs.unoh.net/2007/04/python.htmlを参考にpython 2.5 を自分の$HOMEに作った。

あとはbazaarのソースをとってきて

python setup.py install

したらあっさりインストール完了。やった。

bzr
Bazaar -- a free distributed version-control tool
http://bazaar-vcs.org/

Basic commands:
bzr init makes this directory a versioned branch
bzr branch make a copy of another branch

bzr add make files or directories versioned
bzr ignore ignore a file or pattern
(以下略)

mavenmvn archetype:generateしてみた

自分へのメモ。maven で mvn archetype:generate すると

Choose archetype:
1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
2: internal -> appfuse-basic-spring (AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC)
3: internal -> appfuse-basic-struts (AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2)
4: internal -> appfuse-basic-tapestry (AppFuse archetype for creating a web application with Hibernate, Spring and Tapestry 4)
5: internal -> appfuse-core (AppFuse archetype for creating a jar application with Hibernate and Spring and XFire)
6: internal -> appfuse-modular-jsf (AppFuse archetype for creating a modular application with Hibernate, Spring and JSF)
7: internal -> appfuse-modular-spring (AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC)
8: internal -> appfuse-modular-struts (AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2)
9: internal -> appfuse-modular-tapestry (AppFuse archetype for creating a modular application with Hibernate, Spring and Tapestry 4)
10: internal -> maven-archetype-j2ee-simple (A simple J2EE Java application)
11: internal -> maven-archetype-marmalade-mojo (A Maven plugin development project using marmalade)
12: internal -> maven-archetype-mojo (A Maven Java plugin development project)
13: internal -> maven-archetype-portlet (A simple portlet application)
14: internal -> maven-archetype-profiles ()
15: internal -> maven-archetype-quickstart ()
16: internal -> maven-archetype-site-simple (A simple site generation project)
17: internal -> maven-archetype-site (A more complex site project)
18: internal -> maven-archetype-webapp (A simple Java web application)
19: internal -> jini-service-archetype (Archetype for Jini service project creation)
20: internal -> softeu-archetype-seam (JSF+Facelets+Seam Archetype)
21: internal -> softeu-archetype-seam-simple (JSF+Facelets+Seam (no persistence) Archetype)
22: internal -> softeu-archetype-jsf (JSF+Facelets Archetype)
23: internal -> jpa-maven-archetype (JPA application)
24: internal -> spring-osgi-bundle-archetype (Spring-OSGi archetype)
25: internal -> confluence-plugin-archetype (Atlassian Confluence plugin archetype)
26: internal -> jira-plugin-archetype (Atlassian JIRA plugin archetype)
27: internal -> maven-archetype-har (Hibernate Archive)
28: internal -> maven-archetype-sar (JBoss Service Archive)
29: internal -> wicket-archetype-quickstart (A simple Apache Wicket project)
30: internal -> scala-archetype-simple (A simple scala project)
31: internal -> lift-archetype-blank (A blank/empty liftweb project)
32: internal -> lift-archetype-basic (The basic (liftweb) project)
33: internal -> cocoon-22-archetype-block-plain (http://cocoon.apache.org/2.2/maven-plugins/)
34: internal -> cocoon-22-archetype-block (http://cocoon.apache.org/2.2/maven-plugins/)
35: internal -> cocoon-22-archetype-webapp (http://cocoon.apache.org/2.2/maven-plugins/)
36: internal -> myfaces-archetype-helloworld (A simple archetype using MyFaces)
37: internal -> myfaces-archetype-helloworld-facelets (A simple archetype using MyFaces and facelets)
38: internal -> myfaces-archetype-trinidad (A simple archetype using Myfaces and Trinidad)
39: internal -> myfaces-archetype-jsfcomponents (A simple archetype for create custom JSF components using MyFaces)
40: internal -> gmaven-archetype-basic (Groovy basic archetype)
41: internal -> gmaven-archetype-mojo (Groovy mojo archetype)
Choose a number: (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36/37/38/39/40/41) 15: :

が出て質問に答えてゆくとプロジェクトが作れる。長いオプションを覚えなくてよいので便利。

Gtk周りをインストール

ひとまず、Vista上に構築。

http://gladewin32.sourceforge.net/から以下を取得してインストール。

  • Gtk+ 2.12.9 Runtime Environment Revision 2
  • Glade 3.4.3 for Windows Revision 1 (zip)

後者は解凍してProgram Files以下へおいた。GladeってGUIの開発環境だったのね・・と初めて知った。

http://www.pygtk.org/downloads.htmlから以下を取得して全部インストールしてみました。すべてwindowsインストーラなので簡単簡単。

  • PyCairo
  • PyGObject
  • PyGTK

pythonインタプリタを起動してimport gtkを実行してもエラーにならなかったのでOKだと思われ・・・

Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk

GtkOpenGL使うにはGtkGLExtかGtkGLAreaが必要そうなので、インストールしてみる。(開発された方がNaofumi Yasufukuさんで日本人ぽかったので。)http://www.k-3d.org/gtkglext/Main_Page#Binariesから

  • PyGtk, PyGtkGlext all in one Windows installer

を取得してインストール。こちらもwindowsインストーラなので簡単。