Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a query interface which provides search results like the yjson API from legacy YaCy #11

Open
Orbiter opened this issue Jun 11, 2017 · 8 comments
Labels

Comments

@Orbiter
Copy link
Member

Orbiter commented Jun 11, 2017

This shall implement the query attributes as described in http://www.yacy-websuche.de/wiki/index.php/Dev:APIyacysearch

It shall additionally understand Solr facet query attributes.

The result format is not documented well. It shall return the same result that susper.com understands.
Here is an example:
http://yacy.searchlab.eu/solr/select?hl=false&wt=yjson&facet=true&facet.mincount=1&facet.field=url_file_ext_s&start=0&rows=10&query=berlin

The query interface uses elasticsearch as search endpoint and translates the result into the yjson format.

@harshit98
Copy link
Member

I would like to work on this. 👍

@harshit98
Copy link
Member

@nikhilrayaprolu @Orbiter How to proceed with this issue?

@nikhilrayaprolu
Copy link
Member

@harshit98 according to this issue we might have to create a YjsonResponse similar to this https://github.com/yacy/yacy_search_server/blob/6fe735945da97abcbb91ac545fb11cff9d48effc/source/net/yacy/cora/federate/solr/responsewriter/YJsonResponseWriter.java
but replacing the solr interface with the elastic search.

@nikhilrayaprolu
Copy link
Member

@nikhilrayaprolu
Copy link
Member

@harshit98 what is the status of this issue. @Orbiter any suggestions you would like to give regarding this?

@harshit98
Copy link
Member

@nikhilrayaprolu I have not started it.

@Orbiter
Copy link
Member Author

Orbiter commented Jul 26, 2017

I already implemented the search service in most parts here: https://github.com/yacy/yacy_grid_mcp/blob/master/src/main/java/net/yacy/grid/mcp/api/index/YaCySearchService.java

Because the mcp is the part which has the elasticsearch connection, the search api is also inside the mcp.

What this code has not yet implemented are the facets - no facets at all. To implement them, the search endpoint must be changed in such a way that it uses https://github.com/yacy/yacy_grid_mcp/blob/master/src/main/java/net/yacy/grid/io/index/ElasticsearchClient.java#L726

To do that, a QueryBuilder object must be constructed from the query. Code for this can be copied from https://github.com/yacy/yacy_grid_mcp/blob/master/src/main/java/net/yacy/grid/io/index/ElasticsearchClient.java#L670

Once the search endpoint is changed and is working, the facets can be taken from the aggregations object https://github.com/yacy/yacy_grid_mcp/blob/master/src/main/java/net/yacy/grid/io/index/ElasticsearchClient.java#L714

@nikhilrayaprolu
Copy link
Member

@Orbiter I am trying to build the QueryBuilder object and make it use the Query class
I have code in this form now:

public List<Map<String, Object>> query(final String indexName, final String q, final Operator operator, final int offset, final int count, String... fieldNames) {
        QueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(q, fieldNames).operator(operator).zeroTermsQuery(ZeroTermsQuery.ALL);
        return new Query(indexName,  queryBuilder, order_field, 0, 10, 0,aggregations);
    

right now if we check we are not passing any order_field and aggregations. if so what should be the default values to be passed for both of these parameters?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants