ruby-search-engine 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +62 -15
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4811e5e9d48a22f39b44a5150c2061d17efee443
|
4
|
+
data.tar.gz: 211c8316c12aeeaeaaf21273605d389e63860309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d75ddcbf207d08ae7cefdd4fb8a32e942592ac3f707f138aec7554e75a69281f63263f8cd2db3b44376bda6880eeb3cde17d9626fe923c1784407d068959dc7
|
7
|
+
data.tar.gz: c39313a840f5a865570432a16ddcdb60525046b44e43adead36e0a47a121135b805445c1ca99c49f781386e2fcf6af986026f656f06b17673f31d7b50acb680a
|
data/README.rdoc
CHANGED
@@ -6,37 +6,84 @@ License:: MIT
|
|
6
6
|
|
7
7
|
= Description
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
Search the web using Ruby with this fast and lightweight gem,
|
10
|
+
made to prioritize speed and efficiency. Compared to other search gems,
|
11
|
+
this aims to be minimal, easy to use and most importantly, quick. For
|
12
|
+
any inquiries, please feel free to contact us via email or a pull request.
|
13
|
+
I hope you enjoy using the ruby-search-engine as much as we have had while making it!
|
14
|
+
|
15
|
+
-Matt Le
|
11
16
|
|
12
17
|
= Design
|
13
18
|
|
14
|
-
|
19
|
+
The ruby-search-engine performs a low-level Google search using Google's
|
20
|
+
UDS (User Distributed Search) which will return a JSON object containing
|
21
|
+
the query's results per page. The object is then parsed and stored into a
|
22
|
+
Ruby hash. From there, depending on the fields entered, the search() method
|
23
|
+
will return the desired fields. There is also the option to specify how many
|
24
|
+
pages will be returned. The usage section provides examples of this.
|
25
|
+
|
26
|
+
Fields/options:
|
27
|
+
* GsearchResultClass
|
28
|
+
* unescapedUrl
|
29
|
+
* url
|
30
|
+
* visibleUrl
|
31
|
+
* cacheUrl
|
32
|
+
* title
|
33
|
+
* titleNoFormatting
|
34
|
+
* content
|
35
|
+
|
36
|
+
**Note: fields must be entered as a symbol, ie. :url**
|
15
37
|
|
16
38
|
= Installation
|
17
|
-
gem install ruby-search-
|
39
|
+
gem install ruby-search-engine
|
18
40
|
|
19
|
-
= Alternative Tools
|
20
|
-
|
21
|
-
* google-search[https://github.com/tj/google-search]
|
22
41
|
|
23
42
|
= Usage
|
24
43
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
44
|
+
For a full example, go to bin/ruby_search_engine.rb
|
45
|
+
|
46
|
+
From within your app:
|
47
|
+
|
48
|
+
query = ARGV.join(" ")
|
49
|
+
# gets query from command line, also can use ARGF.read
|
50
|
+
# or
|
51
|
+
|
52
|
+
query = "my query"
|
53
|
+
# query can be any string
|
54
|
+
|
55
|
+
search_engine = SearchEngine.new
|
56
|
+
results = search_engine.search(query, :url, pages: 2)
|
57
|
+
# Calls the search method with the query, url for the field and 2 pages.
|
58
|
+
# results will be an array containing the first 2 pages worth of urls.
|
59
|
+
|
60
|
+
You can also provide input via STDIN on the command line.
|
61
|
+
$ ruby ruby_search_engine.rb QUERY
|
62
|
+
|
63
|
+
You can also run the executable via the ruby_cli gem which can help you make a command line app.
|
64
|
+
|
65
|
+
For a simple query, defaults to 1 page of results:
|
66
|
+
$ ./ruby_search_engine.rb QUERY
|
67
|
+
|
68
|
+
To specify the number of pages wanted:
|
69
|
+
$ ./ruby_search_engine.rb -p 2 QUERY
|
31
70
|
|
32
71
|
= Dependencies
|
33
72
|
|
34
73
|
* Ruby 1.9.1 or greater
|
35
|
-
* ruby_cli[https://github.com/martinvelez/ruby_cli] to run the gem executable
|
74
|
+
* ruby_cli[https://github.com/martinvelez/ruby_cli] to run the gem executable (optional)
|
75
|
+
|
76
|
+
= Alternative Tools
|
77
|
+
|
78
|
+
* google-search[https://github.com/tj/google-search]
|
36
79
|
|
37
80
|
= TODO
|
38
81
|
|
39
|
-
*
|
82
|
+
* Further optimization?
|
83
|
+
* Test to determine limits of current approach, which parses and stores JSON objects.
|
84
|
+
|
85
|
+
* Future features
|
86
|
+
* Different search engines?
|
40
87
|
|
41
88
|
= Source Code
|
42
89
|
https://github.com/martinvelez/ruby-search-engine
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-search-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Velez
|
@@ -26,7 +26,12 @@ dependencies:
|
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 0.2.0
|
29
|
-
description: Search the web using Ruby with this fast and lightweight gem
|
29
|
+
description: "Search the web using Ruby with this fast and lightweight gem, made to
|
30
|
+
prioritize speed and efficiency. Compared to other search gems, this aims to be
|
31
|
+
minimal, easy to use and most importantly, quick. For any inquiries, please feel
|
32
|
+
free to contact us via email or a pull request. I hope you enjoy using the ruby-search-engine
|
33
|
+
as much as we have had while making it!\n\t\t\t\t\t\nhttps://github.com/martinvelez/ruby-search-engine
|
34
|
+
\n-Matt Le"
|
30
35
|
email:
|
31
36
|
- 'marvelez@ucdavis.edu '
|
32
37
|
- mkyen@ucdavis.edu
|
@@ -40,7 +45,8 @@ files:
|
|
40
45
|
- bin/ruby_search_engine.rb
|
41
46
|
- lib/search_engine.rb
|
42
47
|
homepage: http://github.com/martinvelez/ruby-search-engine
|
43
|
-
licenses:
|
48
|
+
licenses:
|
49
|
+
- MIT
|
44
50
|
metadata: {}
|
45
51
|
post_install_message:
|
46
52
|
rdoc_options: []
|