[Surfraw-commits] [surfraw] 01/01: new elvi: yacy

Ian Beckwith ianb at alioth.debian.org
Sun Oct 20 19:26:26 UTC 2013


This is an automated email from the git hooks/post-receive script.

ianb pushed a commit to branch 2.2.9_release_candidate
in repository surfraw.

commit ec6fa73f6d90ce1f61588ac7304e444f9b2e28bb
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Sun Oct 20 20:26:22 2013 +0100

    new elvi: yacy
---
 AUTHORS          |    2 +-
 ChangeLog        |    2 ++
 NEWS             |    1 +
 README           |    1 +
 elvi/Makefile.am |    1 +
 elvi/phpdoc      |    2 +-
 elvi/yacy        |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 links.IN         |    1 +
 test/yacy.test   |    4 +++
 9 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index d59b744..e52c4c3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,7 +16,7 @@ Ian Beckwith <ianb at erislabs.net>
               finkpkg, rpmsearch, macports, debpkghome, debvcsbrowse,
               scroogle, scirus, scitopia, worldwidescience,
               debcodesearch, jquery, mdn, mysqldoc, pgdoc,
-              oraclesearch, S
+              oraclesearch, S, yacy
         plus various tweaks/bugfixes/features.
 
 Moritz Muehlenhoff <jmm at inutil.org>
diff --git a/ChangeLog b/ChangeLog
index 58eebca..889949b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2013-10-20  Ian Beckwith  <ianb at erislabs.net>
 
+	* new elvi: yacy: search using yacy p2p search.
+	  -S searches ScienceNet, a yacy-based science search engine.
 	* rae: fix url, remove -tipo option (no longer supported),
 	  disable test as there is now gratuitous javascript.
 
diff --git a/NEWS b/NEWS
index c1e1463..acabe4f 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,7 @@ Sun Oct  6 02:17:09 BST 2013  - surfraw 2.2.9
           + phpdoc - search PHP documentation
           + pin - search pinboard.in
           + wolfram - search Wolfram Alpha
+          + yacy - search YaCy P2P search engines, including ScienceNet
         * Changed elvi:
           + aur - uses HTTPS by default, use -no-https to disable
           + deblists
diff --git a/README b/README
index 2102a29..57ec203 100644
--- a/README
+++ b/README
@@ -290,6 +290,7 @@ wikipedia       -- Search the free encyclopedia wikipedia
 woffle          -- Search the web using Woffle (localhost:8080)
 wolfram         -- Ask questions of the computational knowledge engine
 worldwidescience -- Search for science with www.worldwidescience.org
+yacy            -- Search YaCy P2P search, including ScienceNet
 yahoo           -- Search Yahoo categories (www.yahoo.com)
 yandex          -- Search the web using Yandex (yandex.ru)
 youtube         -- Search YouTube (www.youtube.com)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index adae4b5..e6d2a27 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -120,6 +120,7 @@ dist_elvi_SCRIPTS	= \
 		  woffle \
 		  wolfram \
 		  worldwidescience \
+		  yacy \
 		  yahoo \
 		  yandex \
 		  youtube \
diff --git a/elvi/phpdoc b/elvi/phpdoc
index a21eba8..fc46e87 100644
--- a/elvi/phpdoc
+++ b/elvi/phpdoc
@@ -1,5 +1,5 @@
 #!/bin/sh
-# elvis: phpdoc    -- Search PHP documentation (php.net)
+# elvis: phpdoc		-- Search PHP documentation (php.net)
 # Author: http://jonyamo.net
 
 . surfraw || exit 1
diff --git a/elvi/yacy b/elvi/yacy
new file mode 100755
index 0000000..598bb1f
--- /dev/null
+++ b/elvi/yacy
@@ -0,0 +1,73 @@
+#!/bin/sh
+# elvis: yacy		-- Search YaCy P2P search, including ScienceNet
+. surfraw || exit 1
+
+w3_config_hook () {
+    def   SURFRAW_yacy_results   "$SURFRAW_results"
+    def   SURFRAW_yacy_site      search.yacy.net
+    defyn SURFRAW_yacy_image     no
+    defyn SURFRAW_yacy_indexonly no
+}
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Surfraw search YaCy P2P search, including ScienceNet
+Local options:
+  -i, -images                   Image Search
+  -I, -indexonly                Constrain search to index pages
+  -S                            search ScienceNet (sciencenet.kit.edu)
+  -s=SITE, --site=SITE          Search SITE
+                                Default: $SURFRAW_yacy_site
+                                Environment: SURFRAW_yacy_site
+  -results=NUM                  Number of search results returned
+                                Default: $SURFRAW_yacy_results
+                                Environment: SURFRAW_yacy_results
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+    -i|-ima*) setoptyn SURFRAW_yacy_image     yes                ;;
+    -I|-ind*) setoptyn SURFRAW_yacy_indexonly yes                ;;
+    -S)       setopt   SURFRAW_yacy_site      sciencenet.kit.edu ;;
+    -s=*)     setopt   SURFRAW_yacy_site      "$optarg"          ;;
+    -r*=*)    setopt   SURFRAW_yacy_results   "$optarg"          ;;
+    *) return 1 ;;
+    esac
+    return 0
+}
+
+w3_config
+w3_parse_args "$@"
+
+url="http://${SURFRAW_yacy_site}/"
+
+if test -z "$w3_args" ; then
+    w3_browse_url "$url"
+else
+    escaped_args=$(w3_url_of_arg $w3_args)
+    url="${url}yacysearch.html?query=${escaped_args}&maximumRecords=${SURFRAW_yacy_results}"
+
+    searchtype=text
+    if ifyes SURFRAW_yacy_image
+    then
+        searchtype=image
+    fi
+    url="${url}&contentdom=${searchtype}"
+    
+    if ifyes SURFRAW_yacy_indexonly
+    then
+        url="${url}&indexof=on"
+    fi
+
+    url="${url}&Enter=Suchen&verify=ifexist&contentdom=text&nav=filetype%2Cprotocol%2Chosts%2Cnamespace%2Ctopics&startRecord=0&indexof=off&meanCount=5&resource=global&prefermaskfilter="
+
+    w3_browse_url "$url"
+fi
+
+
diff --git a/links.IN b/links.IN
index ea1df67..99c3530 100644
--- a/links.IN
+++ b/links.IN
@@ -113,6 +113,7 @@ elvi.1sr.gz @mandir@/man1/wikipedia.1sr.gz
 elvi.1sr.gz @mandir@/man1/woffle.1sr.gz
 elvi.1sr.gz @mandir@/man1/wolfram.1sr.gz
 elvi.1sr.gz @mandir@/man1/worldwidescience.1sr.gz
+elvi.1sr.gz @mandir@/man1/yacy.1sr.gz
 elvi.1sr.gz @mandir@/man1/yahoo.1sr.gz
 elvi.1sr.gz @mandir@/man1/yandex.1sr.gz
 elvi.1sr.gz @mandir@/man1/youtube.1sr.gz
diff --git a/test/yacy.test b/test/yacy.test
new file mode 100644
index 0000000..08d6451
--- /dev/null
+++ b/test/yacy.test
@@ -0,0 +1,4 @@
+yacy yacy
+by the people, for the people
+yacy -S CERN
+European Organization for Nuclear Research

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/surfraw/surfraw.git



More information about the Surfraw-commits mailing list