Upgraded lucene version. Made changes for the results to take message time into consideration.
This commit is contained in:
parent
675480aa9c
commit
7a5f0cd40a
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,4 +5,4 @@ pom.xml
|
|||||||
/classes/
|
/classes/
|
||||||
.lein-deps-sum
|
.lein-deps-sum
|
||||||
ignored_users
|
ignored_users
|
||||||
/index/
|
/index*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
:releases false}}
|
:releases false}}
|
||||||
:dependencies [[org.clojure/clojure "1.2.1"]
|
:dependencies [[org.clojure/clojure "1.2.1"]
|
||||||
[org.clojure/clojure-contrib "1.2.0"]
|
[org.clojure/clojure-contrib "1.2.0"]
|
||||||
[org.apache.lucene/lucene-core "3.1.0"]
|
[org.apache.lucene/lucene-core "3.2.0"]
|
||||||
[org.apache.lucene/lucene-wordnet "3.1.0"]
|
[org.apache.lucene/lucene-wordnet "3.2.0"]
|
||||||
[org.apache.lucene/lucene-analyzers "3.1.0"]
|
[org.apache.lucene/lucene-analyzers "3.2.0"]
|
||||||
[org/pircbotx "1.3-SNAPSHOT"]])
|
[org/pircbotx "1.3-SNAPSHOT"]])
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
[org.apache.lucene.index IndexWriter IndexWriterConfig IndexReader]
|
[org.apache.lucene.index IndexWriter IndexWriterConfig IndexReader]
|
||||||
[org.apache.lucene.search
|
[org.apache.lucene.search
|
||||||
IndexSearcher ScoreDoc Query BooleanQuery TermQuery BooleanClause
|
IndexSearcher ScoreDoc Query BooleanQuery TermQuery BooleanClause
|
||||||
BooleanClause$Occur Filter QueryWrapperFilter]
|
BooleanClause$Occur Filter QueryWrapperFilter Sort SortField]
|
||||||
[org.apache.lucene.queryParser QueryParser]
|
[org.apache.lucene.queryParser QueryParser]
|
||||||
[org.apache.lucene.wordnet AnalyzerUtil])
|
[org.apache.lucene.wordnet AnalyzerUtil])
|
||||||
(:use [clojure.java.io :only (as-file)]))
|
(:use [clojure.java.io :only (as-file)]))
|
||||||
@ -46,7 +46,15 @@
|
|||||||
[query, nil]))
|
[query, nil]))
|
||||||
|
|
||||||
(defn search [^IndexSearcher index-searcher ^Query query ^Filter filter ^Integer max-hits]
|
(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
|
(vector
|
||||||
(.totalHits top-docs)
|
(.totalHits top-docs)
|
||||||
(->>
|
(->>
|
||||||
@ -98,7 +106,7 @@
|
|||||||
|
|
||||||
(defn add-document [^IndexWriter index-writer document]
|
(defn add-document [^IndexWriter index-writer document]
|
||||||
(.addDocument index-writer document))
|
(.addDocument index-writer document))
|
||||||
|
|
||||||
(defn standard-analyzer []
|
(defn standard-analyzer []
|
||||||
(StandardAnalyzer. *lucene-version*))
|
(StandardAnalyzer. *lucene-version*))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user