Difference between revisions of "GetFilter"
From ARK
(Created page with "$ftype = reqQst($_REQUEST, 'ftype'); $src = reqQst($_REQUEST, 'src'); $retftrset = reqQst($_REQUEST, 'retftrset');") |
(→Arguments) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | This method is used to return the results of a filter in a standard ARK results array. It can return the results of a saved filter or can be used to run a simple freetext search. | |
− | + | ||
− | + | ===Path=== | |
+ | |||
+ | http://your.ark.instance/api.php?req=getFilter | ||
+ | |||
+ | ===Arguments=== | ||
+ | |||
+ | *'''ftype''' - The filtertype. Currently only a free text search can be undertaken using the API. If you want to run a free text search ftype needs to be set to 'ftx'. You will also need to send a src. | ||
+ | *'''src''' - This is the free text phrase to search on. Normal Boolean Search (i.e. Google) parameters apply. | ||
+ | |||
+ | If you want to retrieve a previously saved filter (saved using the ARK web interface) use: | ||
+ | |||
+ | *'''retftrset''' - this needs to be set to the numeric id of a saved filter. Current saved filters can be queried using the API method [[describeFilters]](). | ||
+ | |||
+ | If anonymous logins are not enabled a username and password will need to be supplied: | ||
+ | |||
+ | *'''handle''' - username | ||
+ | |||
+ | *'''passwd''' - password | ||
+ | |||
+ | The method returns a JSON array unless otherwise specified: | ||
+ | |||
+ | *'''format''' - 'json' by default, but sending 'html' prints a human-readable array to screen | ||
+ | |||
+ | ===Example=== | ||
+ | |||
+ | ====Example 1 - getting a saved filter==== | ||
+ | |||
+ | http://your.ark.instance/api.php?req=getFilter&retftrset=3&handle=johndoe&passwd=johndoepassword | ||
+ | |||
+ | Example return (returned JSONified - displayed as an array here for ease of viewing): | ||
+ | |||
+ | <pre>Array | ||
+ | ( | ||
+ | [hut_cdLK12_28] => Array | ||
+ | ( | ||
+ | [itemkey] => hut_cd | ||
+ | [itemval] => LK12_28 | ||
+ | [score] => 151 | ||
+ | [snippets] => Array | ||
+ | ( | ||
+ | [0] => Array | ||
+ | ( | ||
+ | [type] => Notes | ||
+ | [snip] => A shaman's house? The counterpart to house 3? | ||
+ | [class] => txt | ||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | [hut_cdLK12_3] => Array | ||
+ | ( | ||
+ | [itemkey] => hut_cd | ||
+ | [itemval] => LK12_3 | ||
+ | [score] => 151 | ||
+ | [snippets] => Array | ||
+ | ( | ||
+ | [0] => Array | ||
+ | ( | ||
+ | [type] => Notes | ||
+ | [snip] => The 'Shaman's House'. One of the most northerly and the only house with a view of Rough Tor directly through it's doorway. | ||
+ | |||
+ | It is associated with a field-shrine/mini-tor to the south and has a small 'hidden' enclosure to the back of the house. SW says that it is hidden from all of the houses - although the viewshed analysis suggests otherwise... | ||
+ | [class] => txt | ||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | ) | ||
+ | </pre> | ||
+ | |||
+ | ====Example 2 - running a free text search==== | ||
+ | |||
+ | http://your.ark.instance/api.php?req=getFilter&ftype=ftx&src=northerly&handle=johndoe&passwd=johndoepassword | ||
+ | |||
+ | Example return (returned JSONified - displayed as an array here for ease of viewing): | ||
+ | |||
+ | <pre>Array | ||
+ | ( | ||
+ | [hut_cdLK12_3] => Array | ||
+ | ( | ||
+ | [itemkey] => hut_cd | ||
+ | [itemval] => LK12_3 | ||
+ | [score] => 151 | ||
+ | [snippets] => Array | ||
+ | ( | ||
+ | [0] => Array | ||
+ | ( | ||
+ | [type] => Notes | ||
+ | [snip] => The 'Shaman's House'. One of the most northerly and the only house with a view of Rough Tor directly through it's doorway. | ||
+ | |||
+ | It is associated with a field-shrine/mini-tor to the south and has a small 'hidden' enclosure to the back of the house. SW says that it is hidden from all of the houses - although the viewshed analysis suggests otherwise... | ||
+ | [class] => txt | ||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | ) | ||
+ | |||
+ | ) | ||
+ | </pre> |
Latest revision as of 15:52, 15 November 2013
This method is used to return the results of a filter in a standard ARK results array. It can return the results of a saved filter or can be used to run a simple freetext search.
Contents
Path
http://your.ark.instance/api.php?req=getFilter
Arguments
- ftype - The filtertype. Currently only a free text search can be undertaken using the API. If you want to run a free text search ftype needs to be set to 'ftx'. You will also need to send a src.
- src - This is the free text phrase to search on. Normal Boolean Search (i.e. Google) parameters apply.
If you want to retrieve a previously saved filter (saved using the ARK web interface) use:
- retftrset - this needs to be set to the numeric id of a saved filter. Current saved filters can be queried using the API method describeFilters().
If anonymous logins are not enabled a username and password will need to be supplied:
- handle - username
- passwd - password
The method returns a JSON array unless otherwise specified:
- format - 'json' by default, but sending 'html' prints a human-readable array to screen
Example
Example 1 - getting a saved filter
http://your.ark.instance/api.php?req=getFilter&retftrset=3&handle=johndoe&passwd=johndoepassword
Example return (returned JSONified - displayed as an array here for ease of viewing):
Array ( [hut_cdLK12_28] => Array ( [itemkey] => hut_cd [itemval] => LK12_28 [score] => 151 [snippets] => Array ( [0] => Array ( [type] => Notes [snip] => A shaman's house? The counterpart to house 3? [class] => txt ) ) ) [hut_cdLK12_3] => Array ( [itemkey] => hut_cd [itemval] => LK12_3 [score] => 151 [snippets] => Array ( [0] => Array ( [type] => Notes [snip] => The 'Shaman's House'. One of the most northerly and the only house with a view of Rough Tor directly through it's doorway. It is associated with a field-shrine/mini-tor to the south and has a small 'hidden' enclosure to the back of the house. SW says that it is hidden from all of the houses - although the viewshed analysis suggests otherwise... [class] => txt ) ) ) )
Example 2 - running a free text search
Example return (returned JSONified - displayed as an array here for ease of viewing):
Array ( [hut_cdLK12_3] => Array ( [itemkey] => hut_cd [itemval] => LK12_3 [score] => 151 [snippets] => Array ( [0] => Array ( [type] => Notes [snip] => The 'Shaman's House'. One of the most northerly and the only house with a view of Rough Tor directly through it's doorway. It is associated with a field-shrine/mini-tor to the south and has a small 'hidden' enclosure to the back of the house. SW says that it is hidden from all of the houses - although the viewshed analysis suggests otherwise... [class] => txt ) ) ) )