68

Search for a document

searchindex

GET https://bezillion.com/api/v1/searchindex?login=&password=

loginYour identification code.
passwordYour password.
qQuery.
fqFilter query.
mmNumber of matching terms.
hlHighlighting.
flAdditional fields.
pagesizeNumber of results per page.
pageNumber of the page of results.

q - search in the text, *:* by default.

fq - filter on the fields in the index.

mm: 1 to 9 - minimum number of matching terms in q. The default value is 0%.

hl: 1 - extracts from the text with highlighting of the terms found. IMPORTANT: If a document was indexed with the parameter stored=0, its plain text isn't available and no highlighting is possible.

fl: 1 - values ​​of the additional fields indexed with a typed document. NOTE: By default, only the additional fields present in fq are returned.

pagesize - number of results to return per page between 10 and 100, 10 by default.

page - number of the page of results to return, 1 by default.

You can test this function in the interface of your personal space.

Extended DisMax Query Parser

Search

 q
 fq

 hl  fl  mm

 2   • 

2026-05-13 13:00 45 en fox.txt

The quick brown fox
jumps over
the lazy dog.

2026-05-13 13:00 30,9k en fox.jpg

The quick brown fox
jumps over
the lazy dog.

The quick brown fox
jumps over
the lazy dog.

Index the file:

$ curl -s --fail --show-error -X POST "https://bezillion.com/api/v1/indexfile?login=abcdef&password=ABCDEF" -F "file=@fox.txt" -o -
{"status":"success","data":null}

Search for the term fox:

$ curl -s --fail --show-error -X GET "https://bezillion.com/api/v1/searchindex?login=abcdef&password=ABCDEF&q=fox&hl=1"
{"status":"success","data":{"count":1,"docs":[{"date":"2026-07-07T15:00:00Z","file":"fox.txt","size":45,"id":"6e4f9696-4e67-4b2a-afcb-c5d1b0c42430","lang":"en","from":"local","stored":true,"score":0.45427877,"hl":["The quick brown fox\njumps over\nthe lazy dog.\n\n"]}]}}

NOTE: If a search returns nothing, the field data is null:

{"status":"success","data":null}

sushi.png

Index the file:

$ curl -s --fail --show-error -X POST "https://bezillion.com/api/v1/indexfile?login=abcdef&password=ABCDEF" -F "lang=eng+jpn+spa" -F "psm=6" -F "file=@sushi.png" -o -

Search for the term pollo:

$ curl -s --fail --show-error -X GET "https://bezillion.com/api/v1/searchindex?login=abcdef&password=ABCDEF&q=pollo&hl=1"
{"status":"success","data":{"count":1,"docs":[{"id":"72c11eb0-36de-409c-b92d-287e78fc30ce","file":"sushi.png","size":14394,"stored":true,"date":"2026-05-13T11:00:00Z","from":"local","lang":"en","score":0.8664339,"hl":["I eat \u3059\u3057 y Pollo<\/em>\n"]}]}}

NOTE: If a search returns nothing, the field data is null 

{"status":"success","data":null}

Search for the term polo:

$ curl -s --fail --show-error -X GET "https://bezillion.com/api/v1/searchindex?login=abcdef&password=ABCDEF&q=polo"
{"status":"fail","data":{"count":0,"suggest":["pollo"]}}

Search for the file sushi.*:

$ curl -s --fail --show-error -X GET "https://bezillion.com/api/v1/searchindex?login=abcdef&password=ABCDEF&fq=file:sushi.*"
{"status":"success","data":{"count":1,"docs":[{"date":"2026-05-13T11:00:00Z","file":"sushi.png","size":14394,"id":"72c11eb0-36de-409c-b92d-287e78fc30ce","lang":"en","from":"local","stored":true,"score":1,"hl":false}]}}

Download the code of the sendget function from the iZend library. Copy the file in the space of your application.

NOTE: See the page Call the service API for a description of the sendget function.

Add the file searchindex.php with the following content:

  1. require_once 'sendhttp.php';

Loads the code of the sendget function.

  1. function searchindex($login, $password, $q=false, $fq=false, $pagesize=10, $page=1, $hl=true, $fl=null) {

Defines the function searchindex. $login is your identification code. $password is your password.

  1.     $curl = 'https://bezillion.com/api/v1/searchindex';

Sets $curl to the URL of the searchindex action of the API.

  1.     $args = array(
  2.         'login'     => $login,
  3.         'password'  => $password,
  4.         'q'         => $q,
  5.         'fq'        => $fq,
  6.         'hl'        => $hl,
  7.         'fl'        => $fl,
  8.         'pagesize'  => $pagesize,
  9.         'page'      => $page,
  10.     );

Prepares the list of arguments of the GET: the identification code and the password of the user's account, the query parameter, the filter query parameter, the page size and the page number.

  1.     $response=sendget($curl, $args);

Sends the HTTP request with sendget.

  1.     if (!$response or $response[0] != 200) {
  2.         return false;
  3.     }

If $response is false, the server is unreachable. If $response[0] doesn't contain the HTTP return code 200 Ok, an execution error has occurred. In case of error, searchindex returns false.

  1.     $r=json_decode($response[2], true);

Decodes the data returned in JSON.

  1.     return $r['data'];
  2. }

Returns the result of the search if the action has succeeded.

EXAMPLE

Assuming you have saved the files sendhttp.php and searchindex.php in the current directory, run PHP in interactive mode, load the searchindex function and call it with as arguments your identification code and password, a term to search in your index:

$ php -a
php > require_once 'searchindex.php';
php > $r=searchindex('abcdef', 'ABCDEF', 'pollo');
php > $print_r($r);
Array
(
    [count] => 1
    [docs] => Array
        (
            [0] => Array
                (
                    [file] => sushi.png
                    [size] => 14394
                    [extra] => 
                    [id] => 72c11eb0-36de-409c-b92d-287e78fc30ce
                    [date] => 2026-05-13T11:00:00Z
                    [from] => local
                    [lang] => en
                    [score] => 0.8451465
                    [stored] => 1
                    [hl] => Array
                        (
                            [0] => I eat すし y Pollo
                        )
                )
        )
)
php > $r=searchindex('abcdef', 'ABCDEF', 'polo' );
php > $print_r($r);
Array
(
    [count] => 0
    [suggest] => Array
        (
            [0] => pollo
        )
)
php > $r=searchindex('abcdef', 'ABCDEF', false, 'file:sushi.*');
php > $print_r($r);
Array
(
    [count] => 1
    [docs] => Array
        (
            [0] => Array
                (
                    [file] => sushi.png
                    [size] => 14394
                    [extra] => 
                    [id] => 72c11eb0-36de-409c-b92d-287e78fc30ce
                    [date] => 2026-05-13T11:00:00Z
                    [from] => local
                    [lang] => en
                    [score] => 1
                    [stored] => 1
                    [hl] => 
                )
        )
)
php > $r=searchindex('abcdef', 'ABCDEF', 'pollo', false, 2);
php > $print_r($r);
php >
php > quit
SEE ALSO

Call the service API, Index a document, Get a document, Relate a document , Unindex a document

Comments