3

I am using spring data solr for my application and trying to implement autocomplete feature.

@SolrDocument

public class UserEntity{

    @Field
    private String id;

    @Field
    private String fullName;

    @Field
    private Date dob;

    @Field
    private String address;

    @Field
    private String phoneNumber;

}

I managed to implement autocomplete for single fields by using spring data solr Criteria . But this got drawback becuase this will return a list of UserEntities. I have to iterate the user list and get the names.

1 . Is there any way that I can get only the matching Names using spring data solr ?

2 . If I need to implement autocomplete across multiple fields (name and address together) is it possible to do it using spring data solr ?

Rahul
  • 3,479
  • 3
  • 16
  • 28

1 Answers1

0

Please have a look at the Solr Example here using Factes for autocomplete.

You also may use a terms vector which requires you to use SolrTemplate.execte(SolrCallback) to access native Solr API.

Christoph Strobl
  • 6,491
  • 25
  • 33