oblivion
oblivion

Reputation: 6548

How to perform partial text search with solr with nested documents?

I am using apache solr for text search. I have nested document structure. This is one.json file :

{
"id": "1",
"info": {
       "first_name": "John",
       "last_name": "Doe",
       "gender": "male"
        }
}

I have created a solr core named "demo" using following command:

solr create -c demo

Then, I posted above record for indexing using the following command:

bin/post -c demo docs2/   //docs2 has the one.json file 

Solr indexed and flattened the above document's nested structure , I guess for better indexing in following form:

{
    "id":["1"],
    "info.first_name":["John"],
    "info.last_name":["Doe"],
    "personal.gender":["male"]
}

Now, when I make the search query with text "John":

http://localhost:8983/solr/demo/select?indent=on&q=John&wt=json

It works and gives the desired result.

But, when I try to make the partial search with text "Joh":

http://localhost:8983/solr/demo/select?indent=on&q=Joh&wt=json

It does not work and returns empty.

How do I make this type of search ? Am I missing some thing for indexing to make partial text search?

Upvotes: 1

Views: 143

Answers (1)

Prafful Nagpal
Prafful Nagpal

Reputation: 349

search for Joh* and this should work

Upvotes: 2

Related Questions