Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gbp/800309a5349ebbdcfba7ef1d58cb795b to your computer and use it in GitHub Desktop.

Select an option

Save gbp/800309a5349ebbdcfba7ef1d58cb795b to your computer and use it in GitHub Desktop.
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 03b009023..0446cf51c 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -113,7 +113,7 @@ class PublicBody < ActiveRecord::Base
[:created_at_numeric, 1, "created_at", :number]
],
:terms => [
- [:name_for_search, 'N', 'name'],
+ [:name_for_search, 'N', 'name', 50],
[:variety, 'V', "variety"],
[:tag_array_for_search, 'U', "tag"]
],
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index bf09ff12f..567a06a3c 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -936,17 +936,11 @@ module ActsAsXapian
if value.kind_of?(Array)
for v in value
doc.add_term(term[1] + v)
-
- if term[1] == 'N'
- doc.add_posting(term[1] + v, 1, 50)
- end
+ doc.add_posting(term[1] + v, 1, term[3]) if term[3]
end
else
doc.add_term(term[1] + value)
-
- if term[1] == 'N'
- doc.add_posting(term[1] + value, 1, 50)
- end
+ doc.add_posting(term[1] + value, 1, term[3]) if term[3]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment