Skip navigation.

Jinglepot Collaboration

About Java and some other stuff..

STICKY POST

Something to start with.

As a software developer, I often get help from the net, there are a lot of nice folks out there have contributed very useful information to help others get their programming problem solved. So I figured why can't I do it as well by simply post my experience and what I've learned on this blog. Hopefully, my articles can help others too. The programming language I am using now is Java, Jsp, and php, but my posts will not limited to Java, there will always be some other posts related to the projects that I work on, like Tomcat, linux, Oracle, and Postgre database etc..

Should there be any technical errors in the articles, please let me know. Thanks.

技術相關文章內若有錯誤之處,歡迎指教, 謝謝.

如果有需要引用本站文章時, 我很感謝您的抬愛, 但請註明來源, 並且歡迎同時告知您的網址, 您的其他文章對我也許更有助益.

Solr schema.xml 的介紹

原來我是打算將Solr wiki裡的介紹直接翻譯成中文, 後來寫一寫覺得, 翻譯的內容太複雜, 很難懂. 所以在這裡我就直接拿一個schema.xml範例來介紹好了. 希望能幫助大家了解schema.xml

<?xml version="1.0" ?>
The Solr schema file. This file should be named "schema.xml" and should be in the conf directory under the solr home (i.e. ./solr/conf/schema.xml by default) or located where the classloader for the Solr webapp can find it.

For more information, on how to customize this file, please see… wiki.apache.org/solr/SchemaXml

Read more...

Velocity - 初步了解

, ,

Velocity常被應用在Java web application的開發過程上。它與PHP 的Smarty相似,可以提供Java開發者跟網頁設計者一起在獨立環境下建造出可擴充性高(模組化)的網路程式。
Velocity可以透過它的樣版直接輸出html ,xml ,還有PostScript 。

VTL – 樣版設計
使用 Velocity 樣板語言建立樣板
Velocity 樣板是文字檔案(HTML、XML 等等),其中包括:
照原樣合併的靜態部分
將被要合併的資料替代的預留位置
程式語言中的指示符號和指令

Velocity - 初步了解 Power point講義 Velocity.zip

Solr POI 全文檢索

, ,

目前Solr運作狀況:
4GB RAM的非專用主機,每天自動更新POI資訊及同義詞庫,並定時自動重啟,已跑了幾個月都沒問題.
之前碰到的系統資源不足問題,是因為我一次index進去800多萬筆的資料, 所以會當機. 現在只是少量幾萬筆的資料更新是輕輕鬆鬆. 再家上每天Optimize一次index,速度快又穩定. Solr真是超強!

善用同義詞SynonymFilterFactory可以解開不少困境. 另外有Dismax Query Handler功能強大.

Solr Java heap space problem solved!

, ,

Solution:
Add this line:

JAVA_OPTS=='-server -Xms512m -Xmx2048m -XX: PermSize=256M -XX:MaxNewSize=512m -XX:MaxPermSize=256m'

into Tomcat initd. and restart Tomcat to set the JVM memory size at Tomcat start up.

Changing JVM heap size by java -Xms512m -Xmx2048m is useless for my case, because when Tomcat restarts, it goes back to original setting, and even if Tomcat never restarts, the memory has already been used by other services, so there is not much left for expanding your JVM memory heap size. Best solution is to get the memory size you want at startup.

Solr 終於正式開用 Solr is finally online for use.

, ,

經過這麼多次的調較 solr 的設定及加入一些search跟xml, xslt對輸出作處理後. solr 終於正式上線. 雖然有時候還是因為資料量太大而產生Java heap size不足的情況, 不過在我盡可能的測試及調較 Linux 裡的 java cached 跟 solr 的 buffer cahed size之後已大大的降低這種情況的發生率. 唯一擔心的就是有時候搜尋結果輸出的速度很慢, 再加上CHT的龜速網路速度外加偶而的網路繁忙,可能還要再研究並解決這個問題.

After many times of tuning, reconfiguring, and adding a few jsp file to process the search query, and parsing the output xml, the solr search is finally online for use. Due to the large data we have, solr often gets java heap size insufficient problem, I've tried my best to change the Java cached size on Linux, and reconfiguring the solrconfig.xml's cached size, the occurence of the problem has been reduced.

Read more...

臺北市獸醫師公會開業會員(醫院)-診療收費表

, ,

上週帶小狗去看獸醫,獸醫就一直說要住院也不告訴我是甚麼問題.
結果我每隔天就打電話問狀況還是一直說要再觀察. 住了一週後跟我說好了要我去領狗,我問是什麼病也說不出來.後來診所會計打電話來說要一萬多塊錢,我都快瘋了. 找了半天確定台北市獸醫工會有規定標準收費價格,獸醫院不得超收,超收及違反獸醫師法第二十四條. 並依同法第三十七條得處新臺幣九千元以下罰鍰。

本想有了這個法很好,市政府也規定動物醫院應該要將公定收費標準刊在易見之處. 可是我都沒看過, 更扯的是我找了工會網站跟市政府網站都找不到公定收費標準,結果我不死心在工會網站上層層的新聞資料裡找到了, 你說怪不怪,大家都不想公開,我在網路上也找不到. 真是官官相護,讓不肖獸醫賺大錢可憐的是寵物的主人.
我在此公開我在工會網站上找到的收費標準,希望大家可以參考.

臺北市獸醫師公會開業會員(醫院)-診療收費表

Solr 中文切詞

, , ,

我試過CJKAnalyzer, ChineseAnalyzer, Standard,及CWordAnalyzer, 發現效果都不是很理想.
目前是使用NGram tokenizer, 加上自己加的CWordTokenFactory來處理index跟query. 當然還要加上一些SynonymFilterFactory來處理中文同義詞的問題.

目前最大問題是上述幾個中文切詞出來的結果都是把詞切開了,但是送出查詢的還是連在一起的句子.無法把切好的詞當成個別詞Token來分開查詢. Example: 每逢淹水蔬果價格就要漲. 用CWord會切成"每 逢 淹水 蔬果 價格 就 要 漲", 雖然我們看起來是切開了,但是送出的query還是:
每 position:0 逢 position:1 淹水 position:2,3 蔬果 position:4,5 價格 position:6,7 就 position:8 要 position:9 漲 position:10

是連續的詞,如果文章理少一個字或多一個字,或位置不對都查不到.

我想要找的是像synonymFilter一樣把把切出來的這些詞當成新的token來檢索搜詢. 要怎麼做? 我看了position的部份還是不甚了解.
最後用slop來處理位置問題.
ChineseAnalyzer裡說 C1C2C3C4 可切成 C1 C2 C3 C4, 並可查得到 C1C2, C2C3, C1C3, C4C2.可是根據我的測試是不可行...

Solr 及 lucene 的 query 使用方法初級解說

, , ,

Solr, Lucene Query 使用方法:
- 檢索/查詢
因為 solr 是用 lucene 的引擎,所以它們的 query 用法原則上是一樣的.

1. 首先假設我的資料裡fields有:name, subbranch, tel, address 預設的搜尋是name這個欄位, 如果要搜尋的資料剛好就是 name 這個欄位,就不需要指定搜尋欄位名稱.

Read more...

Installing solr on Tomcat version 5.5 開源碼Java搜尋引擎 solr 跟 Tomcat 5.5 的安裝步驟

, , , ...

English:
These are some simple steps for installing solr on Tomcat 5.5 Please note the update date of this document, since solr and Tomcat's installation method can be changed in the future, this may not help you if you are referencing this long after I posted this blog entry.

Chinese:
Solr 跟 Lucene的中文資料不容易找,根據我自己經過多次嘗試後安裝成功的經驗在此先記錄下我自己的安裝方法,本來是以為Tomcat 5.5 跟 Tomcat 6.x 會一樣,結果發現有點小改變,但這裡因為我自己用的是Tomcat 5.5跟solr 1.2,所以暫時沒有關於Tomcat 6.x 跟 solr 1.2的詳細安裝方式,如果有人有Tomcat 6.x 跟 solr 1.2的安裝問題再發問吧.

Read more...

December 2009
S M T W T F S
November 2009January 2010
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