Module: Pacer::Filter::LuceneFilter
- Defined in:
- lib/pacer-neo4j/lucene_filter.rb
Instance Attribute Summary collapse
-
#fast ⇒ Object
Returns the value of attribute fast.
-
#index ⇒ Object
Returns the value of attribute index.
-
#query ⇒ Object
Returns the value of attribute query.
-
#reverse_numeric ⇒ Object
Returns the value of attribute reverse_numeric.
-
#sort_by ⇒ Object
Returns the value of attribute sort_by.
-
#sort_by_score ⇒ Object
Returns the value of attribute sort_by_score.
-
#sort_numeric ⇒ Object
Returns the value of attribute sort_numeric.
-
#top ⇒ Object
Returns the value of attribute top.
Instance Method Summary collapse
- #count(max = nil) ⇒ Object
- #fast! ⇒ Object
- #sort(*keys) ⇒ Object
- #sort_by_score! ⇒ Object
- #top_hits(n) ⇒ Object
Instance Attribute Details
#fast ⇒ Object
Returns the value of attribute fast.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def fast @fast end |
#index ⇒ Object
Returns the value of attribute index.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def index @index end |
#query ⇒ Object
Returns the value of attribute query.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def query @query end |
#reverse_numeric ⇒ Object
Returns the value of attribute reverse_numeric.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def reverse_numeric @reverse_numeric end |
#sort_by ⇒ Object
Returns the value of attribute sort_by.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def sort_by @sort_by end |
#sort_by_score ⇒ Object
Returns the value of attribute sort_by_score.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def sort_by_score @sort_by_score end |
#sort_numeric ⇒ Object
Returns the value of attribute sort_numeric.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def sort_numeric @sort_numeric end |
#top ⇒ Object
Returns the value of attribute top.
35 36 37 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 35 def top @top end |
Instance Method Details
#count(max = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 37 def count(max = nil) iter = query_result c = iter.count if c >= 0 c elsif max iter.inject(0) do |n, _| if n == max return :max else n + 1 end end else iter.inject(0) { |n, _| n + 1 } end ensure iter.close end |
#fast! ⇒ Object
72 73 74 75 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 72 def fast! self.fast = true self end |
#sort(*keys) ⇒ Object
62 63 64 65 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 62 def sort(*keys) self.sort_by = keys self end |
#sort_by_score! ⇒ Object
57 58 59 60 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 57 def sort_by_score! self.sort_by_score = true self end |
#top_hits(n) ⇒ Object
67 68 69 70 |
# File 'lib/pacer-neo4j/lucene_filter.rb', line 67 def top_hits(n) self.top = n self end |