compass lucene search results sorting

343 views Asked by At

I almost successfully implemented compass lucene search in my web application.I am searching for a customer with his name. For example in the below screenshot , I am searching for a customer with RAM and below are the results. But there is a small problem,The results shown are not sorted for Names with RAM..it shows all customer names that have the three letters RAM in any position in their name.

I want all my results of Customer Name to start with Letters Ram*... Can anyone guide me how to get results that start with letters RAM.

It should return results like a database search for eg: " Where customername like 'RAM%'

My Analyzer is this

<searchEngine>
          <analyzer name="default" type="Simple">
              <stopWords>
                  <stopWord value="test" />
              </stopWords>
          </analyzer>
    </searchEngine>

This is my annotated field for Customer First name in my entity class.

    @SearchableProperty
@SearchableMetaData(name = "customerFirstName")
private String customerFirstName;

search screen shot

1

There are 1 answers

1
Xodarap On

Just don't start it with a star. "*RAM*" will be anything than includes "RAM". "RAM*" will be things that start with "RAM."