Выполнить нечеткий запрос в JBOSS Data Grid Remote Cache - PullRequest
0 голосов
/ 14 мая 2018

В настоящее время я пытаюсь сделать Fuzzy Query с ICKLE в удаленном кеше JBOSS Data GRID. Ниже мой .proto файл

package quickstart;

/* @Indexed */
message Person {

   /* @Field(index = true, store = true, analyze = true) */
   required string name = 1;

   /* @IndexedField(index = true, store = false) */
   required int32 id = 2;

   optional string email = 3;
   optional string address = 4;

   enum PhoneType {
      MOBILE = 0;
      HOME = 1;
      WORK = 2;
   }

   /* @Indexed */
   message PhoneNumber {

      /* @Field */
      required string number = 1;

      /* @IndexedField(index = false, store = false) */
      optional PhoneType type = 2 [default = HOME];
   }

   /* @Field(index = true, store = false) */
   repeated PhoneNumber phone = 5;
} 
}

Я пытаюсь запустить Below Query

    private void queryPersonByNamebyIckelAndFuzzyDescription() {
        String namePattern = readConsole("Enter person name pattern: ");

        QueryFactory qf = Search.getQueryFactory(remoteCache);
        Query query = qf.create("FROM quickstart.Person where name : '"+namePattern+"'~2");

        List<Person> results = query.list();
        System.out.println("Found " + results.size() + " matches:");
        for (Person p : results) {
            System.out.println(">> " + p);
        }
    } 

Но я получаю ниже исключения

org.infinispan.client.hotrod.exceptions.HotRodClientException: запрос на messageId = 10 вернул ошибку сервера (status = 0x85): org.infinispan.objectfilter.ParsingException: ISPN028521: полнотекстовые запросы нельзя применить к имени свойства 'in type quickstart.Person, если свойство не проиндексировано и не проанализировано.

1 Ответ

0 голосов
/ 16 мая 2018

Изменение его таким способом поможет.

package quickstart;

/* @Indexed 
@Analyzer(definition = "standard")*/
message Person {
/* @Field(store = Store.YES, analyze = Analyze.YES) */
required string name = 1;

...... .....

...