Upgraded lucene version. Made changes for the results to take message time into consideration.

This commit is contained in:
Abhinav Sarkar 2011-06-07 01:06:28 +05:30
parent 675480aa9c
commit 7a5f0cd40a
3 changed files with 15 additions and 7 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@ pom.xml
/classes/
.lein-deps-sum
ignored_users
/index/
/index*/

View File

@ -6,7 +6,7 @@
:releases false}}
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/clojure-contrib "1.2.0"]
[org.apache.lucene/lucene-core "3.1.0"]
[org.apache.lucene/lucene-wordnet "3.1.0"]
[org.apache.lucene/lucene-analyzers "3.1.0"]
[org.apache.lucene/lucene-core "3.2.0"]
[org.apache.lucene/lucene-wordnet "3.2.0"]
[org.apache.lucene/lucene-analyzers "3.2.0"]
[org/pircbotx "1.3-SNAPSHOT"]])

View File

@ -7,7 +7,7 @@
[org.apache.lucene.index IndexWriter IndexWriterConfig IndexReader]
[org.apache.lucene.search
IndexSearcher ScoreDoc Query BooleanQuery TermQuery BooleanClause
BooleanClause$Occur Filter QueryWrapperFilter]
BooleanClause$Occur Filter QueryWrapperFilter Sort SortField]
[org.apache.lucene.queryParser QueryParser]
[org.apache.lucene.wordnet AnalyzerUtil])
(:use [clojure.java.io :only (as-file)]))
@ -46,7 +46,15 @@
[query, nil]))
(defn search [^IndexSearcher index-searcher ^Query query ^Filter filter ^Integer max-hits]
(let [top-docs (.search index-searcher query filter max-hits)]
(let [top-docs
(.search
index-searcher
query
filter
max-hits
(Sort.
(into-array
[SortField/FIELD_SCORE (SortField. "timestamp" SortField/LONG true)])))]
(vector
(.totalHits top-docs)
(->>
@ -98,7 +106,7 @@
(defn add-document [^IndexWriter index-writer document]
(.addDocument index-writer document))
(defn standard-analyzer []
(StandardAnalyzer. *lucene-version*))