Difference between revisions of "Search API"

From Second Life Wiki
Jump to navigation Jump to search
Line 15: Line 15:
Two URL's may be used as follows:
Two URL's may be used as follows:


http://search.secondlife.com/client_search.php?q=Your_text_here
http://search.secondlife.com/client_search.php?q=object


http://secondlife.com/app/search/search_proxy.php?q=Your_text_here
http://secondlife.com/app/search/search_proxy.php?q=object


The difference between the two URL's is that the search proxy redirects to the "search.secondlife.com" domain.
The difference between the two URL's is that the search proxy redirects to the "search.secondlife.com" domain.
Line 28: Line 28:


'''Page 1'''
'''Page 1'''
http://search.secondlife.com/client_search.php?q=Your_text_here&start=0
http://search.secondlife.com/client_search.php?q=object&start=0


'''Page 2'''
'''Page 2'''
http://search.secondlife.com/client_search.php?q=Your_text_here&start=10
http://search.secondlife.com/client_search.php?q=object&start=10


'''Page 3'''
'''Page 3'''
http://search.secondlife.com/client_search.php?q=Your_text_here&start=20
http://search.secondlife.com/client_search.php?q=object&start=20


...
...


'''Page 100'''
'''Page 100'''
http://search.secondlife.com/client_search.php?q=Your_text_here&start=990
http://search.secondlife.com/client_search.php?q=object&start=990


''Note''
''Note''
Line 70: Line 70:
|}
|}


http://search.secondlife.com/client_search.php?q=Your_text_here&region=Here&x=128&y=128&z=36
http://search.secondlife.com/client_search.php?q=object&region=Here&x=128&y=128&z=36


== Mature Content ==
== Mature Content ==
Line 76: Line 76:


'''PG Only'''
'''PG Only'''
http://search.secondlife.com/client_search.php?q=Your_text_here&m=n
http://search.secondlife.com/client_search.php?q=object&m=n


'''PG & Mature'''
'''PG & Mature'''
http://search.secondlife.com/client_search.php?q=Your_text_here&m=y
http://search.secondlife.com/client_search.php?q=object&m=y


In addition, you can still filter out mature results by appending a flag to the query "+-SLS_MATURE".
In addition, you can still filter out mature results by appending a flag to the query "+-SLS_MATURE".


'''PG Only'''
'''PG Only'''
http://search.secondlife.com/client_search.php?q=Your_text_here%20+-SLS_MATURE
http://search.secondlife.com/client_search.php?q=object%20+-SLS_MATURE


'''Mature Only'''
'''Mature Only'''
http://search.secondlife.com/client_search.php?q=Your_text_here%20+SLS_MATURE&m=y
http://search.secondlife.com/client_search.php?q=object%20+SLS_MATURE&m=y


Note: %20 represents a URL Encoded space
Note: %20 represents a URL Encoded space
Line 100: Line 100:
|-
|-
|All categories
|All categories
|http://search.secondlife.com/client_search.php?q=Your_text_here&s=All
|http://search.secondlife.com/client_search.php?q=object&s=All
|-
|-
|Events
|Events
|http://search.secondlife.com/client_search.php?q=Your_text_here&s=Events
|http://search.secondlife.com/client_search.php?q=object&s=Events
|-
|-
|Groups
|Groups
|http://search.secondlife.com/client_search.php?q=Your_text_here&s=Groups
|http://search.secondlife.com/client_search.php?q=object&s=Groups
|-
|-
|People
|People
|http://search.secondlife.com/client_search.php?q=Your_text_here&s=People
|http://search.secondlife.com/client_search.php?q=object&s=People
|-
|-
|Places
|Places
|http://search.secondlife.com/client_search.php?q=Your_text_here&s=Places
|http://search.secondlife.com/client_search.php?q=object&s=Places
|}
|}


Line 128: Line 128:
|Spanish
|Spanish
|es
|es
|http://search.secondlife.com/client_search.php?q=Your_text_here&lang=es
|http://search.secondlife.com/client_search.php?q=object&lang=es
|-
|-
|United States English
|United States English
|en-us
|en-us
|http://search.secondlife.com/client_search.php?q=Your_text_here&lang=en-us
|http://search.secondlife.com/client_search.php?q=object&lang=en-us
|}
|}


Line 138: Line 138:
In addition, another attribute appears in querys when navigating between pages using a standard web browser. It is assumed that this may represent the same value, but only provides the language code without the country code.
In addition, another attribute appears in querys when navigating between pages using a standard web browser. It is assumed that this may represent the same value, but only provides the language code without the country code.


http://search.secondlife.com/client_search.php?q=Your_text_here&hl=en
http://search.secondlife.com/client_search.php?q=object&hl=en


== Output ==
== Output ==
Line 159: Line 159:
|}
|}


http://search.secondlife.com/client_search.php?q=Your_text_here&output=xml_no_dtd&client=raw_xml_frontend
http://search.secondlife.com/client_search.php?q=object&output=xml_no_dtd&client=raw_xml_frontend


== Miscellaneous Information ==
== Miscellaneous Information ==
Line 231: Line 231:


'''Example of proxy search URL'''
'''Example of proxy search URL'''
http://www.google.com/gwt/n?u=http%3A%2F%2Fsearch.secondlife.com%2Fclient_search.php%3Fq%3DYour_text_here&_gwt_noimg=1
http://www.google.com/gwt/n?u=http%3A%2F%2Fsearch.secondlife.com%2Fclient_search.php%3Fq%3Dobject&_gwt_noimg=1

Revision as of 13:40, 7 September 2008

API Guide

What is it?

The Second Life Search API allows you to search the virtual world of Second Life for Events, Groups, People, Places, and this Wiki .

Getting Started

The Second Life Search API is currently using a Google search appliance as the core of the API. You can search against the world using a standard web browser. Two URL's may be used as follows:

http://search.secondlife.com/client_search.php?q=object

http://secondlife.com/app/search/search_proxy.php?q=object

The difference between the two URL's is that the search proxy redirects to the "search.secondlife.com" domain.

Paging

Each query will return 10 results at the most. The parameter passed for paging is "start". This is a zero-based index identifying what record to start with. To view page 1, the following URL may be used.

q= [search for something here] &start= [(page - 1) * 10]

Page 1 http://search.secondlife.com/client_search.php?q=object&start=0

Page 2 http://search.secondlife.com/client_search.php?q=object&start=10

Page 3 http://search.secondlife.com/client_search.php?q=object&start=20

...

Page 100 http://search.secondlife.com/client_search.php?q=object&start=990

Note Any results after page 100 will return nothing.

Location

When searching from the viewer, the location of the avatar is passed along to the Search API. This is optional. The coordinates do not appear to have any effect on the search results. They have the potential to show results based on your current location, (such as displaying nearby snapshots on Snapzilla). The following parameters are used.

Parameter Data type Description
Region string Region name where avatar is located.
X integer Position of avatar in region coordinates on X axis
Y integer Position of avatar in region coordinates on Y axis
Z integer Position of avatar in region coordinates on Z axis

http://search.secondlife.com/client_search.php?q=object&region=Here&x=128&y=128&z=36

Mature Content

By default, the Search API blocks mature content in its results. A parameter "m" may be specified to allow or block mature content. To allow mature content, the value should be "y" meaning "Yes". Blocking mature content will be "n" for "No".

PG Only http://search.secondlife.com/client_search.php?q=object&m=n

PG & Mature http://search.secondlife.com/client_search.php?q=object&m=y

In addition, you can still filter out mature results by appending a flag to the query "+-SLS_MATURE".

PG Only http://search.secondlife.com/client_search.php?q=object%20+-SLS_MATURE

Mature Only http://search.secondlife.com/client_search.php?q=object%20+SLS_MATURE&m=y

Note: %20 represents a URL Encoded space

Category

To limit the results to specific categories, the "s" parameter is used. This value defaults to "All", but can also be set to one of the following: All, Events, Groups, People, Places, Wiki.

Category URI
All categories http://search.secondlife.com/client_search.php?q=object&s=All
Events http://search.secondlife.com/client_search.php?q=object&s=Events
Groups http://search.secondlife.com/client_search.php?q=object&s=Groups
People http://search.secondlife.com/client_search.php?q=object&s=People
Places http://search.secondlife.com/client_search.php?q=object&s=Places

Language

There are a few parameters that identify the language to display the results in. Although the searchable content provided by the residents is not translated, portions of the page are. This includes headers and informational text (such as the number of matching results).

The language (also known as local or culture) specified for the viewers user interface is passed along in the "lang" parameter. These are ISO 639-1 Values for language, and an optional country code (ISO 3166-1). Not all languages are supported. Some languages are in beta.

Language Code URI
Spanish es http://search.secondlife.com/client_search.php?q=object&lang=es
United States English en-us http://search.secondlife.com/client_search.php?q=object&lang=en-us


In addition, another attribute appears in querys when navigating between pages using a standard web browser. It is assumed that this may represent the same value, but only provides the language code without the country code.

http://search.secondlife.com/client_search.php?q=object&hl=en

Output

At the moment, it appears that there are two fields that deal with output. The first "output" is probably telling the search appliance to return xml formatted data. The "client" parameter is then transforming the results into a different format. Since the client is raw_xml_frontend, it is probably not doing any transformation at all and sending us the exact output from the Google appliance.

Parameter Value Notes
output xml_no_dtd xml results from appliance. output format.
client raw_xml_frontend transform into xml results for user agent

http://search.secondlife.com/client_search.php?q=object&output=xml_no_dtd&client=raw_xml_frontend

Miscellaneous Information

There are many other parameters that show up when observing the communications of the Search API. The following properties have been seen, but not identified properly.

Parameter Default Value Notes / Guesses
t n Guessing teen grid. Teen = Y, Adult = N. Without proper session, defaults to N
session 00000000-0000-0000-0000-000000000000 This value changes each time that the SL Viewer logs into the main grid. When querying against the appliance with a standard browser and navigating pages, the value is an empty Guid.
site default_collection
lr (blank)
access p authorization to crawl and index secured content ...?
sort date:D:L:d1 Apparently this "phrase" is all over the net in regards to the default sorting for Google search appliance. Guessing it is sorting by date. Other option is relevance?
dbg 0 Debug Flag?
filter 0
sa N
ie UTF-8 input encoding

Headers

The following headers have been captured while querying against the google search appliance with an in-world viewer.

Host: search.secondlife.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; chrome://navigator/locale/navigator.properties; rv:1.8.1.13) Gecko/20080314 SecondLife/1.20.15.92456 (Second Life Release; silver skin)
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate
Keep-Alive: 300
Connection: keep-alive
Cookie: __utmz=########.##########.#.#.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=########.##################.##########.##########.##########.###; __utmc=########

Work-around for LSL

It should be noted that LSL scripts using ht llHTTPRequest method can not query against the google appliance directly. Linen Lab has blocked all access due to security reasons of requests comming from machines on the local network. To work around this, many people use proxy services. One popular service is offered by google. It is originally intended to make content available for mobile phones. An example of the service in action can be seen by going to the following URL:

Proxy search form http://www.google.com/gwt/n

Example of proxy search URL http://www.google.com/gwt/n?u=http%3A%2F%2Fsearch.secondlife.com%2Fclient_search.php%3Fq%3Dobject&_gwt_noimg=1