NEW TO Couchbase
I created an index in the web console named primary-index
for my collection.
index config
{
"name": "primary-index",
"type": "fulltext-index",
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "type_field",
"type_field": "type"
},
"mapping": {
"analysis": {
"token_filters": {
"length": {
"min": 3,
"max": 255,
"type": "length"
}
}
},
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": true,
"enabled": true
},
"default_type": "_default",
"docvalues_dynamic": true,
"index_dynamic": true,
"store_dynamic": false,
"type_field": "_type"
},
"store": {
"indexType": "scorch"
}
},
"sourceType": "couchbase",
"sourceName": "ads",
"sourceUUID": "cd5969df032f3dc0aa866b189d502839",
"sourceParams": {},
"planParams": {
"maxPartitionsPerPIndex": 171,
"indexPartitions": 6,
"numReplicas": 0
},
"uuid": "22e0659c83a017fb"
}
And when I execute the search from the nodejs SDK
function search(query) {
return cluster.searchQuery(
"primary-index",
couchbase.SearchQuery.queryString(query)
);
}
the following results return but the hit is empty and rows contain the result id and score data
{
meta: {
status: { total: 6, failed: 0, successful: 6 },
request: {
query: [Object],
size: 10,
from: 0,
highlight: null,
fields: null,
facets: null,
explain: false,
sort: [Array],
includeLocations: false,
search_after: null,
search_before: null
},
hits: [],
total_hits: 2,
max_score: 0.05511239428543268,
took: 999600,
facets: null
},
rows: [
{
index: 'primary-index_c7d8134e4c7761c6_18572d87',
id: 'bf006cf4-93f3-4237-bff3-cf44fd213d81',
score: 0.05511239428543268,
sort: [Array]
},
{
index: 'primary-index_c7d8134e4c7761c6_aa574717',
id: 'f219ef9e-c183-451c-8df0-735721a0d903',
score: 0.05424442643471465,
sort: [Array]
}
]
}
Why result don’t contain collections fields eg: title, description ?
one of the collection
{
"category": {
"field": "device",
"item": "phone & tablet accessories"
},
"location": {
"district": "Ampara",
"city": "Akkarepattu"
},
"title": "Samsung original hands free ",
"description": "The first thing I did ",
"price": 15000,
"condition": "new",
"brand": "Samsung ",
"negotiable": true
}