Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Add collection:searchSpecifications#89

Merged
jenow merged 9 commits into
3-devfrom
KZL-1462-collection-searchSpecifications
May 4, 2020
Merged

Add collection:searchSpecifications#89
jenow merged 9 commits into
3-devfrom
KZL-1462-collection-searchSpecifications

Conversation

@y-abs
Copy link
Copy Markdown
Contributor

@y-abs y-abs commented Apr 16, 2020

What does this PR do ?

This PR adds collection:searchSpecifications with its units tests.

Sample code :

import io.kuzzle.sdk.*;
import io.kuzzle.sdk.CoreClasses.Responses.Response;
import io.kuzzle.sdk.CoreClasses.SearchResult;
import io.kuzzle.sdk.Options.SearchOptions;
import io.kuzzle.sdk.Options.KuzzleOptions;
import io.kuzzle.sdk.Options.Protocol.WebSocketOptions;
import io.kuzzle.sdk.Options.SearchOptions;
import io.kuzzle.sdk.Protocol.WebSocket;

import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;

public class searchSpecifications {
    private static Kuzzle kuzzle;

    public static void main(String[] args) {
        WebSocketOptions opts = new WebSocketOptions();
        opts.setAutoReconnect(true).setConnectionTimeout(42000);

        try {
            WebSocket ws = new WebSocket("localhost", opts);

            kuzzle = new Kuzzle(ws, (KuzzleOptions) null);
            kuzzle.connect();
            

            ConcurrentHashMap<String, Object> searchQuery = new ConcurrentHashMap<>();
            ConcurrentHashMap<String, Object> filters = new ConcurrentHashMap<>();
            ConcurrentHashMap<String, Object> boost = new ConcurrentHashMap<>();

            boost.put("boost", 1);
            filters.put("match_all", boost);
            searchQuery.put("query", filters);

            SearchOptions options = new SearchOptions();
            options.setSize(50);
            options.setFrom(0);
            options.setScroll("10s");

            SearchResult result = kuzzle
                 .getCollectionController()
                 .searchSpecifications(searchQuery, options).get();

            System.out.println(result.hits);
        }  catch (Exception e) {
            e.printStackTrace();
        }
        kuzzle.disconnect();
    }
};

How should this be manually tested?

  • Step 1 :
  • Step 2 :
  • Step 3 :
    ...

Other changes

Correct how refresh option is passed and adapt tests

Boyscout

@y-abs y-abs self-assigned this Apr 16, 2020
Comment thread doc/3/controllers/collection/search-specifications/index.md Outdated
Comment thread doc/3/core-classes/search-result/next/index.md Outdated
@y-abs y-abs requested a review from Aschen April 26, 2020 13:49
ConcurrentHashMap<String, Object> filters = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> boost = new ConcurrentHashMap<>();

boost.put("boost", 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use boost ?

Copy link
Copy Markdown
Contributor Author

@y-abs y-abs Apr 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO you can remove it, it will confuse the user I think

@y-abs y-abs requested a review from Aschen April 26, 2020 14:51
@jenow jenow merged commit cb63275 into 3-dev May 4, 2020
@jenow jenow mentioned this pull request May 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants