Download the PHP package opensearchserver/opensearchserver without Composer

On this page you can find all versions of the php package opensearchserver/opensearchserver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package opensearchserver

OpenSearchServer PHP Client

OpenSearchServer is an Open-Source professionnal search engine offering lots of advanced features:

Find out all the awesome features offered by OpenSearchServer on our website: http://www.opensearchserver.com/

======================================

This API connector is intended to be used with PHP 5 (any version >= 5.3) and Composer. It is based on the V2 API of OpenSearchServer.

Setup

Quick start

A global handler must be created. It will be used to submit every request to your OpenSearchServer instance:

Each API request is wrapped in a particular class. Requests must be instanciated, configured and then passed to $oss_api->submit() that will return an OpenSearchServer\Response object.

Create an index

This code creates an index based on our "WEB_CRAWLER" template, which will automatically create a schema allowing to easily crawl a website.

Configure web crawler

Add some allowed patterns:

Note character *: it means crawler will be allowed to follow any URL starting by these patterns.

Add some start URLs for crawler:

Here * is not used since real URL are given to crawler: it will use these URLs as first entry points.

Start crawler:

Index documents

While crawler is running some documents can still be manually indexed:

Here objects of type OpenSearchServer\Document\Document() are being used to create documents, but some other options exist: passing array, passing JSON, ... See documentation below to know all about this.

Search:

It is quite easy then to search for documents:

Client Documentation

Table of contents

How to make requests

In this PHP client requests to OpenSearchServer's API are objects. Each request object must be submitted to a global handler that is in charge of sending them to an OpenSearchServer instance and returning a response.

Create an handler

Create a request

Several types of objects are available, each being a mapping to one API. For instance objects of type OpenSearchServer\Index\Create will be used to create index and objects of type OpenSearchServer\Search\Field\Search will be used to search for documents.

Each request object is a child of the abstract parent class OpenSearchServer\Request.

For example here is the code to create a request that wil create an index when sent to an OpenSearchServer instance:

After being created each type of request must be configured in a particular way, depending on its type, by calling some methods.

For example this code will tell OpenSearchServer to name the new index "first_index":

Important note:

This method will not be documented further but will be displayed in code examples when needed.

Once configured request must be sent to an OpenSearchServer instance thanks to the handler created before:

Create request by using an array of JSON parameters

JSON body of request can be given as an array of JSON parameters to the constructor. If values are given this way every data set by calling specific methods on this request will be ignored.

However some methods must still be called to set index on which work and every parameters used directly in request's URL.

Example: create a Search field template:

Create request by using JSON text

JSON body of request can be given as a JSON strings to the constructor. If values are given this way every data set by calling specific methods on this request or by giving JSON array values will be ignored.

However some methods must still be called to set index on which work and every parameters used directly in request's URL.

Example: create a Search field template:

Handle response and search results

Several types of responses can be returned by submit(). Internally this method uses a Factory that builds a response depending on the type of Request given.

OpenSearchServer\Response\Response

Main Response class.

OpenSearchServer\Response\ResponseIterable

Extends OpenSearchServer\Response\Response. Used when response contain iterable values. This class implements \Iterator and can thus be used in a loop structure.

OpenSearchServer\Response\SearchResult

Extends OpenSearchServer\Response\ResponseIterable. Used for search results.

Example of array of facets:

Example: this class being iterable it can also be used in a loop structure:

This class creates object of type OpenSearchServer\Response\Result:

OpenSearchServer\Response\MoreLikeThisResult

This kind of response looks like OpenSearchServer\Response\SearchResult but with fewer features, since results returned by MoreLikeThis query are simpler.

OpenSearchServer\Response\SpellCheckResult

This response is returned by SpellCheck queries. It is used to access spell check suggestions for each asked field.

Example:

Available methods:

Work with index

Create an empty index

Go to API documentation for this method

Create an index with a template

Two pre-configured templates are offered with OpenSearchServer: WEB_CRAWLER and FILE_CRAWLER. Each template comes with pre-configured schema, queries, renderers.

Template WEB_CRAWLER:

Template FILE_CRAWLER:

Get list of index on an instance

Go to API documentation for this method

This class does not need a call to ->index() before submission.

Delete an index

Go to API documentation for this method

Check if an index exists

Go to API documentation for this method

Instance monitoring

Several instance-wide monitoring properties can be retrieved:

This would display for example:



Available methods:

Configure schema

In OpenSearchServer each index must have a schema. A schema is a list of fields, each with some properties.

Create a field

Go to API documentation for this method

Available methods:

Create full schema at once

Schema can be totally created at once using some JSON Text or JSON array of values with object of type OpenSearchServer\Field\CreateBulk.

Get list of fields

Go to API documentation for this method

Get details of a specific field

Go to API documentation for this method

Available methods:

Delete a field

Go to API documentation for this method

Available methods:

Set default and unique field for an index

Go to API documentation for this method

Available methods:

Analyzers

Create an analyzer

Go to API documentation for this method

Analyzer can be created or updated using some JSON Text or JSON array of values with object of type OpenSearchServer\Analyzer\Create.

Available methods:

Get list of analyzers

Go to API documentation for this method

Get details of a specific analyzer

Go to API documentation for this method

Available methods:

Delete an analyzer

Available methods:

Web Crawler

Patterns

Available methods for Insert and Delete classes:

Insert inclusion patterns

Go to API documentation for this method

List inclusion patterns

Go to API documentation for this method

Delete inclusion patterns

Go to API documentation for this method

Insert exclusion patterns

Go to API documentation for this method

List exclusion patterns

Go to API documentation for this method

Delete exclusion patterns

Go to API documentation for this method

Set status for inclusion and exclusion lists

Inject URL in URL database

In addition to inserting pattern it is also needed to tell crawler which URL it should use to start crawling. It will then discover automatically new URLs to crawl.

Force crawling of URL

Same as "Manual crawl" in OpenSearchServer's interface. Given URL must be in inclusion patterns.

If you want OSS to return the crawled data (content of the page and all extracted fields), use method returnData(true):

Start web crawler

Go to API documentation for this method

Stop web crawler

Go to API documentation for this method

Get web crawler status

Go to API documentation for this method

File crawler

Start file crawler

Available method:

Stop file crawler

Get file crawler status

File repositories

Every type of location share some common methods for insertion:

Available methods:

List repositories

Get list of existing repositories in one index.

Local file

Insert local file location
Delete local file location

One method must be called to target location to delete.

Available method:

FTP

Insert FTP location

Available methods:

Delete FTP location

Several methods must be called to target location to delete.

Available methods:

SMB/CIFS

Insert SMB/CIFS location

Available methods:

Delete SMB/CIFS location

Several methods must be called to target location to delete.

Available methods:

Swift

Insert Swift location

Available methods:

Delete Swift location

Several methods must be called to target location to delete.

Available methods:

REST crawler

List existing REST crawlers

Execute a REST crawler

Available methods:

Parse files

OpenSearchServer is able to parse files from lots of different types. Parsers allow for extraction of information inside documents.

Methods for this API do not require an index to work with, since parsing is "index-free". Those API do not index any data, they simply parse files and send back parsed data.

List existing parsers

Go to API documentation for this method

Get details about a specific parser

Go to API documentation for this method

Parse a file by uploading it

Go to API documentation for this method

Use this API to send a file to OpenSearchServer and get back parsed data.

Another way to send the file is by using a particular method of the Handler. This method does not use the Buzz HTTP client but rather directly makes a CURL call, using CurlFile to send the file.

The file path must be given using method filePath() instead of file(), and request must be submitted using submitFile() instead of submit().

This method is more direct and will use less memory than the previous one.

Parse a file located on the server

Go to API documentation for this method

Use this API to ask OpenSearchServer to parse a file located on its server, and get back parsed data.

Parse a file and let OpenSearchServer detect its type

Go to API documentation for this method

Use this API to send a file or to parse a file located on the server: OpenSearchServer will try to automatically detect its MIME type to apply the correct parser on it.

Available methods:

Autocompletion

Create an autocompletion

Go to API documentation for this method

Autocompletion are "sub-index" for OpenSearchServer. They need to be created and configured with fields to use for suggestions.

Available methods:

Build autocompletion

Go to API documentation for this method

Autocompletion sub-index need to be re-built frequently, when content on main index changes. This can be automatized with OpenSearchServer's Schedulers or done by calling this API.

Available methods:

Get list of existing autocompletion items

Go to API documentation for this method

Several autocompletion items can be built, each with particular fields for some specific purpose.

Query autocompletion

Go to API documentation for this method

Available methods:

Delete an autocompletion item

Go to API documentation for this method

Available methods:

Documents

Push documents

Go to API documentation for this method

Add document with array notation

Add documents by creating OpenSearchServer\Document\Document objects

Available methods:

Available methods for object of type OpenSearchServer\Document\Document:

Add documents by pushing text file

Go to API documentation for this method

Text files in CSV or TTL can be pushed to OpenSearchServer, with a regexp pattern to match fields.

Available methods:

Delete documents

Go to API documentation for this method

Available methods:

Delete documents using an existing query template or using a query pattern

Go to API documentation for this method

Available methods:

One or the other of these 2 methods must be used:

Execute search queries

Search options

Two types of search queries exist in OpenSearchServer : Search field and Search pattern.

They both offer lots of common options and only differ in the way of specfiying searched fields:

Available methods:

Search(field)

Go to API documentation for this method

Fields that must be searched are specified precisely in this kind of query:

Available methods:

Save a Search(field) query template

Go to API documentation for this method

Query template can be registered to be used later without having to give every parameters. They can also be edited with the administration interface.

Search(pattern)

Go to API documentation for this method

With this kind of query searched fields are configured with a pattern language:

Save a Search(pattern) query template

Go to API documentation for this method

Query template can be registered to be used later without having to give every parameters. They can also be edited with the administration interface.

Search templates

As shown above it is possible to save several search templates for future use.

List search templates

Go to API documentation for this method

Get details of a search template

Go to API documentation for this method

Delete a search template

Go to API documentation for this method

Search in batch

Multiple queries can be sent at once. Results will be returned for each query, unless parameter mode is set to first: then queries will stop as soon as one return results.

Queries must be created as usual: Search field, Search pattern, with or without template.

Available methods:

Response for this request will be of type SearchBatchResult.

Available methods for SearchBatchResult:

Synonyms

Create a list of synonyms

Go to API documentation for this method

Available methods:

Check if a list of synonyms exists

Go to API documentation for this method

Available methods:

Get existing lists of synonyms

Go to API documentation for this method

Get synonyms of a list

Go to API documentation for this method

Available methods:

Delete a list of synonyms

Go to API documentation for this method

Available methods:

Stop words

Create a list of stop words

Available methods:

Check if a list of stop words exists

Available methods:

Get existing lists of stop words

Get stop words of a list

Available methods:

Delete a list of stop words

Available methods:

More like this queries

Create a more like this query template

Go to API documentation for this method

Available methods:

Delete a more like this query template

Go to API documentation for this method

Available methods:

Get list of more like this query templates

Go to API documentation for this method

Get details of a more like this query template

Go to API documentation for this method

Available methods:

Execute a more like this search

Go to API documentation for this method

Available methods:

Every other methods of OpenSearchServer\MoreLikeThis\Create can be used there.

Spellcheck queries

It is not possible at the moment to create Spellcheck query templates through API. Spellcheck query templates can be listed, deleted and used for a search.

Get list of spellcheck query templates

Delete a spellcheck query template

Execute a spellcheck search

Scheduler

Get status of a scheduler job

Go to API documentation for this method

Available method:

Execute a scheduler job

Go to API documentation for this method

Available method:

Replication

Get list of replications

Go to API documentation for this method

Get details about one replication

Go to API documentation for this method

Available method:

Create or update a replication

Go to API documentation for this method

Available method:

Start a replication

Go to API documentation for this method

Available method:

Delete a replication

Go to API documentation for this method

Available method:

===========================

OpenSearchServer PHP Client Copyright 2008-2016 Emmanuel Keller / Jaeksoft http://www.opensearchserver.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


All versions of opensearchserver with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
kriswallsmith/buzz Version >=0.6 <0.17
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package opensearchserver/opensearchserver contains the following files

Loading the files please wait ....