GetFilter

From ARK
Revision as of 16:32, 14 November 2013 by Stuarteve (talk | contribs) (Path)

Jump to: navigation, search

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

Example

Example 1 - getting a saved filter

http://your.ark.instance/api.php?request=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

http://your.ark.instance/api.php?request=getFilter&ftype=ftx&src=northerly&handle=johndoe&passwd=johndoepassword

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
                        )

                )

        )

)