93 lines
2.3 KiB
Text
93 lines
2.3 KiB
Text
# Full text search
|
|
|
|
The pg_search Ruby gem is used for full-text searched in Rails.
|
|
See: https://github.com/Casecommons/pg_search
|
|
|
|
Reformatted SQL query for fulltext search:
|
|
|
|
SELECT COUNT(*) FROM "packages" WHERE (
|
|
(
|
|
(
|
|
to_tsvector('simple', coalesce("packages"."name"::text, ''))
|
|
||
|
|
to_tsvector('simple', coalesce("packages"."description"::text, ''))
|
|
||
|
|
to_tsvector('simple', coalesce("packages"."long_description"::text, ''))
|
|
)
|
|
@@
|
|
(
|
|
to_tsquery('simple', '''' || 'browser' || ' ''')
|
|
)
|
|
)
|
|
)
|
|
|
|
# Index:
|
|
|
|
CREATE INDEX packages_gin ON packages USING GIN( (to_tsvector('simple',
|
|
coalesce("packages"."name"::text, '')) || to_tsvector('simple',
|
|
coalesce("packages"."description"::text, '')) || to_tsvector('simple',
|
|
coalesce("packages"."long_description"::text, ''))) );
|
|
|
|
---------
|
|
|
|
Used: https://github.com/semaperepelitsa/jquery.fileupload-rails
|
|
Which is a gem for: https://github.com/blueimp/jQuery-File-Upload
|
|
|
|
Paperclip for attachment/screenshot file handlind within ActiveRecord
|
|
https://github.com/thoughtbot/paperclip
|
|
|
|
--
|
|
|
|
Components:
|
|
|
|
- Rails 5 (widespread, up-to-date, solves many common problems)
|
|
- PostgreSQL (fast, easy, I don't like MySQL, good fulltext search)
|
|
- Git (most people nowadays use Git)
|
|
- jQuery (well known and easy to use)
|
|
- Zurb Foundation (integrates nicer than Twitter Bootstrap)
|
|
- Guard for automated testing (http://www.rubydoc.info/gems/guard-rails)
|
|
|
|
--
|
|
|
|
Importer
|
|
|
|
How Debian repositories are organized: https://wiki.debian.org/RepositoryFormat
|
|
|
|
--
|
|
|
|
Logging from within the application into the database's "log" table:
|
|
|
|
Log.log "foo"
|
|
or with section (default='frontend'):
|
|
Log.log "foo", "importer"
|
|
|
|
--
|
|
|
|
To create admin users
|
|
---------------------
|
|
|
|
rails c
|
|
> User.new(email: 'email@christoph-haas.de', password: 'secret').save
|
|
|
|
---
|
|
|
|
Multiple distributions (e.g. Ubuntu, Debian)
|
|
- new table: distributions
|
|
- id
|
|
- name (e.g. "Debian")
|
|
- description (e.g. "The Debian GNU/Linux distribution")
|
|
- url (http://www.debian.org/)
|
|
- type (apt, later: rpm)
|
|
- logo
|
|
|
|
- screenshots: new field for source_id
|
|
|
|
Admin interface to manage sources
|
|
|
|
---
|
|
|
|
AppStream data
|
|
- screenshots: new field for type ('user-generated', 'upstream', 'logo')
|
|
user-generated: uploaded by a random user
|
|
upstream: official screenshot from the developer
|
|
logo: not a screenshot - just a logo
|