<commit_before>require "spec_helper"

describe Xapit::Server::Database do
  before(:each) do
    load_xapit_database
    @database = Xapit.database
  end

  it "has a xapian database" do
    @database.xapian_database.should be_kind_of(Xapian::WritableDatabase)
  end

  it "adds a document to the database" do
    @database.xapian_database.doccount.should == 0
    @database.add_document(:attributes => {:greeting => {:value => "hello world", :text => {}}})
    @database.xapian_database.doccount.should == 1
  end

  it "queries the database for results" do
    @database.add_document(:attributes => {:greeting => {:value => "hello world", :text => {}}}, :id => 123, :class => "Greeting")
    @database.query([{:search => "hello"}]).should == {:records => [{:class => "Greeting", :id => "123", :relevance => 100}], :facets => {}}
  end
end<commit_msg>fixing a broken spec<commit_after>require "spec_helper"

describe Xapit::Server::Database do
  before(:each) do
    load_xapit_database
    @database = Xapit.database
  end

  it "has a xapian database" do
    @database.xapian_database.should be_kind_of(Xapian::WritableDatabase)
  end

  it "adds a document to the database" do
    @database.xapian_database.doccount.should == 0
    @database.add_document(:attributes => {:greeting => {:value => "hello world", :text => {}}})
    @database.xapian_database.doccount.should == 1
  end

  it "queries the database for results" do
    @database.add_document(:attributes => {:greeting => {:value => "hello world", :text => {}}}, :id => 123, :class => "Greeting")
    @database.query([{:search => "hello"}])[:records].should == [{:class => "Greeting", :id => "123", :relevance => 100}]
  end
end
{'fraction_non_alphanumeric': 0.16784869976359337, 'fraction_numerical': 0.013002364066193853, 'mean_word_length': 4.4789644012944985, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7130765', 'n_tokens_mistral': 592, 'n_tokens_neox': 555, 'n_words': 136}