Module: Xapit
- Defined in:
- lib/xapit.rb,
lib/xapit/facet.rb,
lib/xapit/query.rb,
lib/xapit/config.rb,
lib/xapit/collection.rb,
lib/xapit/membership.rb,
lib/xapit/facet_option.rb,
lib/xapit/facet_blueprint.rb,
lib/xapit/index_blueprint.rb,
lib/xapit/indexers/simple_indexer.rb,
lib/xapit/indexers/classic_indexer.rb,
lib/xapit/adapters/abstract_adapter.rb,
lib/xapit/indexers/abstract_indexer.rb,
lib/xapit/adapters/data_mapper_adapter.rb,
lib/xapit/adapters/active_record_adapter.rb,
lib/xapit/query_parsers/simple_query_parser.rb,
lib/xapit/query_parsers/classic_query_parser.rb,
lib/xapit/query_parsers/abstract_query_parser.rb
Overview
Looking for more documentation? A good place to start is Xapit::Membership
Defined Under Namespace
Modules: Membership Classes: AbstractAdapter, AbstractIndexer, AbstractQueryParser, ActiveRecordAdapter, ClassicIndexer, ClassicQueryParser, Collection, Config, DataMapperAdapter, Facet, FacetBlueprint, FacetOption, IndexBlueprint, Query, SimpleIndexer, SimpleQueryParser
Class Method Summary collapse
-
.index_all(*args, &block) ⇒ Object
Index all membership classes with xapit defined.
-
.remove_database ⇒ Object
Removes the configured database file and clears the stored one in memory.
-
.search(*args) ⇒ Object
Used to perform a search on all indexed models.
- .serialize_value(value) ⇒ Object
-
.setup(*args) ⇒ Object
Setup configuration options.
Class Method Details
.index_all(*args, &block) ⇒ Object
Index all membership classes with xapit defined. Delegates to Xapit::IndexBlueprint. You will likely want to call Xapit.remove_database before this.
9 10 11 |
# File 'lib/xapit.rb', line 9 def self.index_all(*args, &block) IndexBlueprint.index_all(*args, &block) end |
.remove_database ⇒ Object
Removes the configured database file and clears the stored one in memory.
38 39 40 |
# File 'lib/xapit.rb', line 38 def self.remove_database Config.remove_database end |
.search(*args) ⇒ Object
Used to perform a search on all indexed models. The returned collection can contain instances of different classes which were indexed.
# perform a simple full text search
@records = Xapit.search("phone")
See Xapit::Membership for details on search options.
20 21 22 |
# File 'lib/xapit.rb', line 20 def self.search(*args) Collection.new(nil, *args) end |
.serialize_value(value) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/xapit.rb', line 42 def self.serialize_value(value) if value.kind_of?(Date) Xapian.sortable_serialise(value.to_time.to_i) elsif value.kind_of?(Time) Xapian.sortable_serialise(value.to_i) elsif value.kind_of?(Numeric) || value.to_s =~ /^[0-9]+$/ Xapian.sortable_serialise(value.to_f) else value.to_s.downcase end end |
.setup(*args) ⇒ Object
Setup configuration options. The following options are supported.
:database_path
: Where the database is stored. :stemming
: The language to use for stemming, defaults to “english”. :spelling
: True or false to enable/disable spelling, defaults to true. :indexer
: Class to handle the indexing, defaults to SimpleIndexer. :query_parser
: Class to handle the parsing, defaults to ClassicQueryParser. :breadcrumb_facets
: Use breadcrumb mode for applied facets. See Collection#applied_facet_options for details.
33 34 35 |
# File 'lib/xapit.rb', line 33 def self.setup(*args) Config.setup(*args) end |