Cannot make a search on all fields
See original GitHub issueHello, i am new with search index in node JS and i tried to make a search engine from Json file but it doesn’t work for all fields. here is my code
var express = require('express');
var router = express.Router();
var fs = require('fs')
var JSONStream = require('JSONStream')
var options = {
"batchSize": 1000,
"fieldedSearch": true,
"preserveCase": false,
"storeable": true,
"searchable": true,
"indexPath": "data",
"logLevel": "error",
"nGramLength": [1]
}
var searchIndex = require('search-index')
var dataset = require('../node_modules/reuters-21578-json/data/justTen/justTen.json')
/* GET users listing. */
router.get('/', function(req, res, next) {
searchIndex(options, function(err, si) {
// si.flush(function(err) {
// if (!err) console.log('success!')
//})
si.concurrentAdd(dataset, {}, function(err) {
if (!err) console.log('indexed!')
else return callback(err, {})
console.log(si.fields);
console.log('doing a test search...')
si.search({"query": [
{AND: {'*':["COCOA"]}}]} , function(err, results) {
console.log('total hits: ' + results.totalHits)
for (var i = 0; i < results.hits.length; i++) {
console.log()
console.log('* ' + results.hits[i].document.title + ' *')
console.log('* ' + results.hits[i].document.date + ' *')
console.log()
console.log('--------------------')
}
res.status(200).send(results.hits)
})
})
});
//res.end();
// res.end(results.hits);
});
module.exports = router;
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
How to search over all fields and return every document ...
I have a index with multiple documents with several fields. I want to be able to search over all the fields running a...
Read more >Simple Kibana "term query" not searching the all the fields
The problem now is that Kibana doesn't search log.message using term queries (just using "query here" in the Kibana search bar without explicit ......
Read more >FIND Query not searching IN ALL FIELDS RETURN
I want to be able to enter an account name and retrieve a list of opportunities. This works for opportunity name only, but...
Read more >How do i search all fields at once? - Jira - Atlassian Community
1 answer. You can use "text ~ xyz" to search all the text based fields, but select list fields are different and can't...
Read more >Can't search all contact fields - Salesforce Stack Exchange
I am an administrator with the Nonprofit CRM version of Salesforce I am trying to make a contact database for people who have...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok thank you, now it works, but can i stream json file instead of str file ?
ok thank you