Skip to content

codelibs/fess-suggest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fess-suggest Java CI with Maven

Library for suggest.

Usage

Create suggester instance

String suggestId = "id";
Suggester suggester = Suggester.builder().build(client, suggestId);

Suggest

SuggestResponse response = suggester.suggest().setQuery("kensaku").execute().getResponse();

Suggest async

suggester.suggest().setQuery("kensaku").execute()
  .done(
    response -> {}
  ).error(
    t -> {}
  );

Add suggest document

String[][] readings = new String[2][];
readings[0] = new String[] { "kensaku", "fuga" };
readings[1] = new String[] { "enjin", "fuga" };
String[] tags = new String[] { "tag1", "tag2" };
String[] roles = new String[] { "role1", "role2", "role3" };
suggester.indexer().index(new SuggestItem(new String[] { "検索", "エンジン" }, readings, 1, tags, roles, SuggestItem.Kind.DOCUMENT));

Add suggest documents from source of index

DocumentReader reader = new ESSourceReader(
    client,
    suggester.settings(),
    "contentIndexName",
    "contentTypeName");
suggester.indexer().indexFromDocument(reader, 2, 100).getResponse();

Add suggest document from queryLog

QueryLog queryLog = new QueryLog("field1:value1", null);
suggester.indexer().indexFromQueryLog(queryLog);