Hi @mschoch ,
Thanks for the immediate reply. As suggested by you I have created I have the index using keyword analyzer.
{
“type”: “fulltext-index”,
“name”: “movies-index”,
“uuid”: “35f5501ea4ee643e”,
“sourceType”: “couchbase”,
“sourceName”: “movies”,
“sourceUUID”: “b83aaf0f430524843b1add3f33effac3”,
“planParams”: {
“maxPartitionsPerPIndex”: 171
},
“params”: {
“doc_config”: {
“mode”: “type_field”,
“type_field”: “type”
},
“mapping”: {
“default_analyzer”: “standard”,
“default_datetime_parser”: “dateTimeOptional”,
“default_field”: “_all”,
“default_mapping”: {
“dynamic”: true,
“enabled”: false
},
“default_type”: “_default”,
“index_dynamic”: true,
“store_dynamic”: false,
“types”: {
“movie”: {
“default_analyzer”: “keyword”,
“dynamic”: false,
“enabled”: true,
“properties”: {
“title”: {
“dynamic”: false,
“enabled”: true,
“fields”: [
{
“include_in_all”: true,
“include_term_vectors”: true,
“index”: true,
“name”: “title”,
“store”: true,
“type”: “text”
}
]
}
}
}
}
},
“store”: {
“kvStoreName”: “mossStore”
}
},
“sourceParams”: {}
}
Also used a combination of DisjunctionQuery and QueryStringQuery.
public static void findDocByTextMatch(String searchText) {
String title = "title:";
QueryStringQuery query1 = new QueryStringQuery(title.concat(searchText)).boost(16);
QueryStringQuery query2 = new QueryStringQuery(title.concat(searchText).concat("*")).boost(8);
QueryStringQuery query3 = new QueryStringQuery(title.concat("*").concat(searchText).concat("*")).boost(4);
QueryStringQuery query4 = new QueryStringQuery(title.concat("*").concat(searchText)).boost(2);
DisjunctionQuery disjunctionQuery = new DisjunctionQuery();
disjunctionQuery.or(query1, query2, query3, query4);
SearchQueryResult result = bucket.query(
new SearchQuery("movies-index", disjunctionQuery));
for (SearchQueryRow hit : result.hits()) {
System.out.println("****** score := " + hit.score() + " and content := "
+ bucket.get(hit.id()).content().get("title"));
}
}
where my search text is spiderman.
The problem I am facing here is even with different boost values I am getting the same response. That means even if I reverse the boost order, I am getting the same response.